From 6a9774d54011632fc1607d63d7bd56ce6a902e15 Mon Sep 17 00:00:00 2001 From: Alex Date: Wed, 21 Feb 2024 01:01:12 +0300 Subject: [PATCH] Update functions.php Skip delay if timeout is equels 0.0 --- src/functions.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/functions.php b/src/functions.php index 681be126..dde40762 100644 --- a/src/functions.php +++ b/src/functions.php @@ -62,6 +62,9 @@ function now(): float */ function delay(float $timeout, bool $reference = true, ?Cancellation $cancellation = null): void { + if ($timeout === 0.0) { + return; + } $suspension = EventLoop::getSuspension(); $callbackId = EventLoop::delay($timeout, static fn () => $suspension->resume()); $cancellationId = $cancellation?->subscribe(