Skip to content

Commit

Permalink
热更新时关闭协程死锁检查
Browse files Browse the repository at this point in the history
  • Loading branch information
yunwuxin committed Nov 25, 2024
1 parent 6859577 commit 213f6ba
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/concerns/InteractsWithServer.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
namespace think\swoole\concerns;

use Swoole\Constant;
use Swoole\Coroutine;
use Swoole\Process;
use Swoole\Process\Pool;
use Swoole\Runtime;
Expand Down Expand Up @@ -54,6 +55,9 @@ public function start(string $envName): void
{
$this->setProcessName('manager process');

//协程配置
Coroutine::set($this->getConfig('coroutine', []));

$this->initialize();
$this->triggerEvent('init');

Expand Down Expand Up @@ -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) {
Expand Down

0 comments on commit 213f6ba

Please sign in to comment.