Skip to content

Commit f374e54

Browse files
authored
Don't handle TimeoutException if processTimeout is disabled (#20)
1 parent 3e7908a commit f374e54

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

core/src/main/scala/com/avast/clients/rabbitmq/DefaultRabbitMQClientFactory.scala

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -523,16 +523,18 @@ private[rabbitmq] object DefaultRabbitMQClientFactory extends LazyLogging {
523523
val timedOutAction = if (processTimeout == Duration.ZERO) {
524524
action
525525
} else {
526-
action.timeout(ScalaDuration(processTimeout.toMillis, TimeUnit.MILLISECONDS))
526+
action
527+
.timeout(ScalaDuration(processTimeout.toMillis, TimeUnit.MILLISECONDS))
528+
.onErrorRecoverWith {
529+
case e: TimeoutException =>
530+
timeoutsMeter.mark()
531+
logger.warn(s"[$name] Task timed-out, applying DeliveryResult.${consumerConfig.timeoutAction}", e)
532+
Task.now(consumerConfig.timeoutAction)
533+
}
527534
}
528535

529536
timedOutAction
530537
.onErrorRecoverWith {
531-
case e: TimeoutException =>
532-
timeoutsMeter.mark()
533-
logger.warn(s"[$name] Task timed-out, applying DeliveryResult.${consumerConfig.timeoutAction}", e)
534-
Task.now(consumerConfig.timeoutAction)
535-
536538
case NonFatal(e) =>
537539
fatalFailuresMeter.mark()
538540
logger.warn(s"[$name] Error while executing callback, applying DeliveryResult.${consumerConfig.failureAction}", e)

0 commit comments

Comments
 (0)