Skip to content

Commit

Permalink
PDO based queues: Fix consume looping attempting to processs queue it…
Browse files Browse the repository at this point in the history
…ems we say waiting but no longer exist in the queue
  • Loading branch information
AllenJB committed Dec 18, 2020
1 parent 2c0d109 commit 8d9d664
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/Pdo/Queue.php
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,8 @@ public function consume(callable $callback, float $timeoutSecs): void
->withCorrelationId($row["correlation_id"]);

$callback($this, $message);
} else {
$waitingReplies = 0;
}

if (microtime(true) > $tsLimit) {
Expand Down
2 changes: 2 additions & 0 deletions src/Pdo/ReplyQueue.php
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,8 @@ public function consume(callable $callback, float $timeoutSecs): void
if (($this->expectedResponseCount !== null) && ($this->responses >= $this->expectedResponseCount)) {
break;
}
} else {
$waitingReplies = 0;
}

if (microtime(true) > $tsLimit) {
Expand Down

0 comments on commit 8d9d664

Please sign in to comment.