From a746fd50aa973da8c07cffa7da49630ae884dde1 Mon Sep 17 00:00:00 2001 From: Lau Ernebjerg Josefsen <44977457+LauJosefsen@users.noreply.github.com> Date: Mon, 27 Jun 2022 15:29:02 +0200 Subject: [PATCH] Moved opcache clearing to before bootWorker (#547) --- src/Swoole/Handlers/OnWorkerStart.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Swoole/Handlers/OnWorkerStart.php b/src/Swoole/Handlers/OnWorkerStart.php index b6e310885..fc6d41152 100644 --- a/src/Swoole/Handlers/OnWorkerStart.php +++ b/src/Swoole/Handlers/OnWorkerStart.php @@ -31,6 +31,8 @@ public function __construct( */ public function __invoke($server, int $workerId) { + $this->clearOpcodeCache(); + $this->workerState->server = $server; $this->workerState->workerId = $workerId; $this->workerState->workerPid = posix_getpid(); @@ -38,7 +40,6 @@ public function __invoke($server, int $workerId) $this->dispatchServerTickTaskEverySecond($server); $this->streamRequestsToConsole($server); - $this->clearOpcodeCache(); if ($this->shouldSetProcessName) { $isTaskWorker = $workerId >= $server->setting['worker_num'];