Skip to content

Commit f5907e5

Browse files
committed
Update after feedback
Signed-off-by: Rick Brouwer <[email protected]>
1 parent a76c344 commit f5907e5

File tree

2 files changed

+7
-13
lines changed

2 files changed

+7
-13
lines changed

CHANGELOG.md

+1-2
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,6 @@ Here is an overview of all new **experimental** features:
7979
### Improvements
8080

8181
- **General**: Add SecretKey to AWS SecretsManager TriggerAuthentication to allow parsing JSON / Key/Value Pairs in secrets ([#5940](https://github.com/kedacore/keda/issues/5940))
82-
- **General**: Add time.Duration in TypedConfig ([#6650](https://github.com/kedacore/keda/pull/6650))
8382
- **Azure Log Analytics Scaler**: Add custom HTTP client timeout ([#6607](https://github.com/kedacore/keda/pull/6607))
8483
- **Elasticsearch Scaler**: Support IgnoreNullValues at Elasticsearch scaler ([#6599](https://github.com/kedacore/keda/pull/6599))
8584
- **GitHub Scaler**: Add support to use ETag for conditional requests against the Github API ([#6503](https://github.com/kedacore/keda/issues/6503))
@@ -126,7 +125,7 @@ New deprecation(s):
126125
### Other
127126

128127
- **General**: Add debug logs tracking validation of ScaledObjects on webhook ([#6498](https://github.com/kedacore/keda/pull/6498))
129-
- **General**: Fix fallback validation check bug ([#6407](https://github.com/kedacore/keda/pull/6407))
128+
- **General**: Add time.Duration in TypedConfig ([#6650](https://github.com/kedacore/keda/pull/6650))
130129
- **General**: New eventreason KEDAScalersInfo to display important information ([#6328](https://github.com/kedacore/keda/issues/6328))
131130
- **Apache Kafka Scaler**: Remove unused awsEndpoint in Apache Kafka scaler ([#6627](https://github.com/kedacore/keda/pull/6627))
132131
- **External Scalers**: Allow `float64` values in externalmetrics' `MetricValue` & `TargetSize`. The old fields are still there because of backward compatibility. ([#5159](https://github.com/kedacore/keda/issues/5159))

pkg/scalers/rabbitmq_scaler.go

+6-11
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ type rabbitMQMetadata struct {
9696
// specify the operation to apply in case of multiples queues
9797
Operation string `keda:"name=operation, order=triggerMetadata, default=sum"`
9898
// custom http timeout for a specific trigger
99-
TimeoutMs int `keda:"name=timeout, order=triggerMetadata, optional"`
99+
Timeout time.Duration `keda:"name=timeout, order=triggerMetadata, optional"`
100100

101101
Username string `keda:"name=username, order=authParams;resolvedEnv, optional"`
102102
Password string `keda:"name=password, order=authParams;resolvedEnv, optional"`
@@ -210,13 +210,10 @@ func (r *rabbitMQMetadata) validateTrigger() error {
210210
return fmt.Errorf("protocol %s not supported; must be http to use mode %s", r.Protocol, rabbitModeMessageRate)
211211
}
212212

213-
if r.Protocol == amqpProtocol && r.TimeoutMs != 0 {
214-
return fmt.Errorf("amqp protocol doesn't support custom timeouts: %d", r.TimeoutMs)
213+
if r.Protocol == amqpProtocol && r.Timeout != 0 {
214+
return fmt.Errorf("amqp protocol doesn't support custom timeouts: %d", r.Timeout)
215215
}
216216

217-
if r.TimeoutMs < 0 {
218-
return fmt.Errorf("timeout must be greater than 0: %d", r.TimeoutMs)
219-
}
220217
return nil
221218
}
222219

@@ -260,11 +257,9 @@ func NewRabbitMQScaler(config *scalersconfig.ScalerConfig) (Scaler, error) {
260257

261258
s.metadata = meta
262259

263-
var timeout time.Duration
264-
if s.metadata.TimeoutMs != 0 {
265-
timeout = time.Duration(s.metadata.TimeoutMs) * time.Millisecond
266-
} else {
267-
timeout = config.GlobalHTTPTimeout
260+
timeout := config.GlobalHTTPTimeout
261+
if s.metadata.Timeout != 0 {
262+
timeout = s.metadata.Timeout * time.Millisecond
268263
}
269264

270265
s.httpClient = kedautil.CreateHTTPClient(timeout, meta.UnsafeSsl)

0 commit comments

Comments
 (0)