From 3e6dfd3ae997f2b9a3ccdf2d1a61307bdc4af46f Mon Sep 17 00:00:00 2001 From: Marcelo Andrade R Date: Mon, 19 Nov 2018 11:57:27 -0500 Subject: [PATCH] DEV-108 - Fix pausing issues of queue and reserved ones --- src/Db.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/Db.php b/src/Db.php index 50a2d5f..b6a70bf 100644 --- a/src/Db.php +++ b/src/Db.php @@ -164,6 +164,7 @@ public function process(callable $worker, $delay = 1, $limit = null, $timeout = 'failure' => 0, 'skipped' => 0, ]; + while ($processed++ < $limit && ($job = $this->reserve($timeout, $delay))) { $result = $worker($job->getBody(), $job); if ($result) { @@ -176,6 +177,9 @@ public function process(callable $worker, $delay = 1, $limit = null, $timeout = $job->bury(); ++$stats['failure']; } + if ($this->connection->isUnderTransaction()) { + $this->connection->commit(); + } } return $stats;