From 7247b0effd00457a4dcd38b7424516c7fa57a9cf Mon Sep 17 00:00:00 2001 From: Jake Barnby Date: Wed, 3 Jun 2026 04:22:36 +1200 Subject: [PATCH] fix(messaging): skip non-positive retry backoff sleep Swoole\Coroutine::sleep() rejects 0/negative values (CI runs unit tests with the real Swoole extension, where the Fiber test polyfill is inert). The retry tests override the base delay to 0 for speed, which made sleep(0.0) abort the process under real Swoole. Guard the call; production delays are always >= 1s. Co-Authored-By: Claude Opus 4.8 (1M context) --- src/Appwrite/Platform/Workers/Messaging.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/Appwrite/Platform/Workers/Messaging.php b/src/Appwrite/Platform/Workers/Messaging.php index 0154716021..911db304dd 100644 --- a/src/Appwrite/Platform/Workers/Messaging.php +++ b/src/Appwrite/Platform/Workers/Messaging.php @@ -666,9 +666,13 @@ class Messaging extends Action } // Exponential backoff with jitter; non-blocking under Swoole so sibling sends keep progressing. + // Skip a non-positive delay: Swoole\Coroutine::sleep() rejects 0/negative values (which tests + // produce by overriding the base delay to 0 for speed), and it would otherwise emit a warning. $delay = $this->retryDelay() * (2 ** ($attempt - 1)); $delay += $delay * (\random_int(0, 100) / 1000); - \Swoole\Coroutine::sleep($delay); + if ($delay > 0) { + \Swoole\Coroutine::sleep($delay); + } } return [