diff --git a/src/Appwrite/Utopia/Http/Adapter/SwooleCoroutine/Server.php b/src/Appwrite/Utopia/Http/Adapter/SwooleCoroutine/Server.php index d4d0f98411..0f732f6814 100644 --- a/src/Appwrite/Utopia/Http/Adapter/SwooleCoroutine/Server.php +++ b/src/Appwrite/Utopia/Http/Adapter/SwooleCoroutine/Server.php @@ -85,7 +85,7 @@ class Server extends Adapter public function start() { - go(function () { + $startServer = function (): void { $this->initializeRequestSemaphore(); if ($this->onStartCallback) { @@ -93,7 +93,15 @@ class Server extends Adapter } $this->server->start(); - }); + }; + + if (Coroutine::getCid() !== -1) { + $startServer(); + + return; + } + + \Swoole\Coroutine\run($startServer); } private function initializeRequestSemaphore(): void