From 213f6ba9ca1df96b045e64bf4d7e3e5d0ed44fcc Mon Sep 17 00:00:00 2001 From: yunwuxin <448901948@qq.com> Date: Mon, 25 Nov 2024 15:03:40 +0800 Subject: [PATCH] =?UTF-8?q?=E7=83=AD=E6=9B=B4=E6=96=B0=E6=97=B6=E5=85=B3?= =?UTF-8?q?=E9=97=AD=E5=8D=8F=E7=A8=8B=E6=AD=BB=E9=94=81=E6=A3=80=E6=9F=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/concerns/InteractsWithServer.php | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/concerns/InteractsWithServer.php b/src/concerns/InteractsWithServer.php index 1f71204..5bbf9cb 100644 --- a/src/concerns/InteractsWithServer.php +++ b/src/concerns/InteractsWithServer.php @@ -3,6 +3,7 @@ namespace think\swoole\concerns; use Swoole\Constant; +use Swoole\Coroutine; use Swoole\Process; use Swoole\Process\Pool; use Swoole\Runtime; @@ -54,6 +55,9 @@ public function start(string $envName): void { $this->setProcessName('manager process'); + //协程配置 + Coroutine::set($this->getConfig('coroutine', [])); + $this->initialize(); $this->triggerEvent('init'); @@ -134,8 +138,12 @@ public function runWithBarrier(callable $func, ...$params) */ protected function addHotUpdateProcess() { - $this->addWorker(function (Process\Pool $pool) { + //热更新时关闭协程死锁检查 + Coroutine::set([ + 'enable_deadlock_check' => false, + ]); + $this->addWorker(function (Process\Pool $pool) { $watcher = $this->container->make(Watcher::class); $watcher->watch(function () use ($pool) {