mirror of
https://github.com/appwrite/appwrite.git
synced 2026-11-18 20:36:03 +00:00
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) <noreply@anthropic.com>
This commit is contained in:
1 parent
7c8d7dcb80
commit
7247b0effd
1 file changed
+5
-1
@@ -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 [
|
||||
|
||||
Reference in new issue
Block a user