@@ -96,7 +96,7 @@ type rabbitMQMetadata struct {
96
96
// specify the operation to apply in case of multiples queues
97
97
Operation string `keda:"name=operation, order=triggerMetadata, default=sum"`
98
98
// 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"`
100
100
101
101
Username string `keda:"name=username, order=authParams;resolvedEnv, optional"`
102
102
Password string `keda:"name=password, order=authParams;resolvedEnv, optional"`
@@ -210,13 +210,10 @@ func (r *rabbitMQMetadata) validateTrigger() error {
210
210
return fmt .Errorf ("protocol %s not supported; must be http to use mode %s" , r .Protocol , rabbitModeMessageRate )
211
211
}
212
212
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 )
215
215
}
216
216
217
- if r .TimeoutMs < 0 {
218
- return fmt .Errorf ("timeout must be greater than 0: %d" , r .TimeoutMs )
219
- }
220
217
return nil
221
218
}
222
219
@@ -260,11 +257,9 @@ func NewRabbitMQScaler(config *scalersconfig.ScalerConfig) (Scaler, error) {
260
257
261
258
s .metadata = meta
262
259
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
268
263
}
269
264
270
265
s .httpClient = kedautil .CreateHTTPClient (timeout , meta .UnsafeSsl )
0 commit comments