Skip to content

Commit

Permalink
Option to disable process timeout for consumer (#19)
Browse files Browse the repository at this point in the history
  • Loading branch information
jendakol authored Dec 11, 2018
1 parent e6a8562 commit 3e7908a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
2 changes: 1 addition & 1 deletion core/src/main/resources/reference.conf
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ avastRabbitMQConsumerDefaults {

// queueName = "test"

processTimeout = 10s
processTimeout = 10s // 0 for disable the timeout

prefetchCount = 100

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -520,8 +520,13 @@ private[rabbitmq] object DefaultRabbitMQClientFactory extends LazyLogging {
.map(Task.fromEffect[F, DeliveryResult])
.flatten

action
.timeout(ScalaDuration(processTimeout.toMillis, TimeUnit.MILLISECONDS))
val timedOutAction = if (processTimeout == Duration.ZERO) {
action
} else {
action.timeout(ScalaDuration(processTimeout.toMillis, TimeUnit.MILLISECONDS))
}

timedOutAction
.onErrorRecoverWith {
case e: TimeoutException =>
timeoutsMeter.mark()
Expand Down

0 comments on commit 3e7908a

Please sign in to comment.