Skip to content

Commit be9dbd7

Browse files
committed
timeout logic changes
1 parent 7801923 commit be9dbd7

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/RabbitMqMessageChannel.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,10 @@ function (AMQPMessage $message) use ($messageHandler) {
125125
$start = microtime(true);
126126
while ($this->channel->is_consuming()) {
127127
$duration = microtime(true) - $start;
128-
$channelWaitingTimeout = ($maxRunningTimeInSeconds - $duration) ?: -1;
128+
$channelWaitingTimeout = ($maxRunningTimeInSeconds - $duration) ?: 1;
129+
if ($maxRunningTimeInSeconds && $channelWaitingTimeout <= 1) {
130+
break;
131+
}
129132
$this->channel->wait(null, false, $maxRunningTimeInSeconds ? $channelWaitingTimeout : 0);
130133
}
131134
} catch (AMQPTimeoutException $exception) {

0 commit comments

Comments
 (0)