From 20883e301dc40b271e4a4e5d91ff86ad91f06961 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pablo=20de=20la=20Pen=CC=83a?= Date: Mon, 2 Nov 2026 20:50:08 +0000 Subject: [PATCH 1/2] fix: log the real retry time and back off while idle The RETRY line printed the job's old available_at, because the worker discarded the job returned by retryJob(). It now prints the new due time. An idle worker slept for a fixed QUEUE_WORKER_WAIT_TIME. It now doubles the wait on each empty poll, up to 5000ms, and starts again after a job, as the README described. Co-Authored-By: Claude Sonnet 5.5 --- src/Console/Command/Work.php | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/src/Console/Command/Work.php b/src/Console/Command/Work.php index 37c75c4..0d4a241 100644 --- a/src/Console/Command/Work.php +++ b/src/Console/Command/Work.php @@ -26,6 +26,11 @@ class Work extends Base implements SignalableCommandInterface { + /** + * The longest, in milliseconds, an idle worker will wait between polls + */ + protected const MAX_WAIT_TIME = 5000; + protected Logger $logger; protected Database $database; protected Manager $manager; @@ -250,12 +255,12 @@ protected function startEventLoop(array $queues): void $maxRetries = max(0, (int) $job->task::getMaxRetries()); $currentTries = (int) ($job->attempts ?? 0); if ($currentTries < $maxRetries) { - $this->manager->retryJob($job, $e); + $retried = $this->manager->retryJob($job, $e); $logMessage = sprintf( 'RETRY %d/%d (next at %s)', $currentTries + 1, $maxRetries, - $job->available_at->format('H:i:s') + $retried->available_at->format('H:i:s') ); } else { $logMessage = 'FAILED'; @@ -283,6 +288,12 @@ protected function startEventLoop(array $queues): void usleep($chunk * 1000); $remainingMs -= $chunk; } + + // Back off while idle; the wait resets once a job has been run + $waitTime = min( + $waitTime * 2, + max(static::MAX_WAIT_TIME, Config::get('QUEUE_WORKER_WAIT_TIME', 500)) + ); } } catch (Throwable $e) { From dd9bbf0a7b7a40de6fa229eaedca4e0cdcd0c69c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pablo=20de=20la=20Pen=CC=83a?= Date: Mon, 2 Nov 2026 20:56:14 +0000 Subject: [PATCH 2/2] ci: use the pre-new-admin root version for the migration check migration_numbering.yml still pinned COMPOSER_ROOT_VERSION to dev-develop, so composer install could not resolve on this branch: module-find-replace requires module-queue dev-feature/pre-new-admin, which conflicts with a root declared as dev-develop. build_and_test.yml already uses the right version. Co-Authored-By: Claude Sonnet 5.5 --- .github/workflows/migration_numbering.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/migration_numbering.yml b/.github/workflows/migration_numbering.yml index d2801df..cc4e109 100644 --- a/.github/workflows/migration_numbering.yml +++ b/.github/workflows/migration_numbering.yml @@ -38,7 +38,7 @@ jobs: # The check itself ships with nails/common - name: Install Composer dependencies - run: COMPOSER_ROOT_VERSION=dev-develop composer install --no-interaction --prefer-dist + run: COMPOSER_ROOT_VERSION=dev-feature/pre-new-admin composer install --no-interaction --prefer-dist # The branch being merged into is not a counterpart to compare against - name: Check migration numbering