From d86dd6beef05d384b429b03a6495fbcf72223626 Mon Sep 17 00:00:00 2001 From: walkor Date: Thu, 19 Dec 2024 10:25:10 +0800 Subject: [PATCH] Optimization --- src/Worker.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Worker.php b/src/Worker.php index c71dd306..42cf2f7f 100644 --- a/src/Worker.php +++ b/src/Worker.php @@ -1568,8 +1568,8 @@ protected static function forkWorkersForWindows(): void // Create a global event loop. if (static::$globalEvent === null) { - $eventLoopClass = $worker->eventLoop ?: static::$eventLoopClass; - static::$globalEvent = new $eventLoopClass(); + static::$eventLoopClass = $worker->eventLoop ?: static::$eventLoopClass; + static::$globalEvent = new static::$eventLoopClass(); static::$globalEvent->setErrorHandler(function ($exception) { static::stopAll(250, $exception); }); @@ -1708,8 +1708,8 @@ protected static function forkOneWorkerForLinux(self $worker): void // Create a global event loop. if (static::$globalEvent === null) { - $eventLoopClass = $worker->eventLoop ?: static::$eventLoopClass; - static::$globalEvent = new $eventLoopClass(); + static::$eventLoopClass = $worker->eventLoop ?: static::$eventLoopClass; + static::$globalEvent = new static::$eventLoopClass(); static::$globalEvent->setErrorHandler(function ($exception) { static::stopAll(250, $exception); });