@@ -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+ TimeoutMs 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"`
@@ -214,9 +214,6 @@ func (r *rabbitMQMetadata) validateTrigger() error {
214214 return fmt .Errorf ("amqp protocol doesn't support custom timeouts: %d" , r .TimeoutMs )
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
260+ timeout := config . GlobalHTTPTimeout
264261 if s .metadata .TimeoutMs != 0 {
265- timeout = time .Duration (s .metadata .TimeoutMs ) * time .Millisecond
266- } else {
267- timeout = config .GlobalHTTPTimeout
262+ timeout = s .metadata .TimeoutMs * time .Millisecond
268263 }
269264
270265 s .httpClient = kedautil .CreateHTTPClient (timeout , meta .UnsafeSsl )
0 commit comments