diff --git a/src/Adapter/Swoole/EventLoop.php b/src/Adapter/Swoole/EventLoop.php index a057ed2..ffa8e0e 100644 --- a/src/Adapter/Swoole/EventLoop.php +++ b/src/Adapter/Swoole/EventLoop.php @@ -99,8 +99,10 @@ public function promiseRejected(\Throwable $throwable): Promise public function idle(): Promise { $promise = new YieldPromise(); - Coroutine::create(function() use($promise) { - $promise->resolve(null); + Coroutine::create(function() use ($promise) { + Coroutine::defer(function () use ($promise) { + $promise->resolve(null); + }); }); return $promise;