mirror of
https://github.com/zhamao-robot/zhamao-framework.git
synced 2026-07-21 23:55:35 +08:00
update to 2.5.0-b3 (build 410)
This commit is contained in:
@@ -4,12 +4,13 @@
|
||||
namespace ZM\Event\SwooleEvent;
|
||||
|
||||
|
||||
use Swoole\Coroutine;
|
||||
use Swoole\Server;
|
||||
use Swoole\Timer;
|
||||
use ZM\Annotation\Swoole\SwooleHandler;
|
||||
use ZM\ConnectionManager\ManagerGM;
|
||||
use ZM\Console\Console;
|
||||
use ZM\Event\SwooleEvent;
|
||||
use ZM\Store\LightCacheInside;
|
||||
|
||||
/**
|
||||
* Class OnWorkerExit
|
||||
@@ -20,9 +21,10 @@ class OnWorkerExit implements SwooleEvent
|
||||
{
|
||||
public function onCall(Server $server, $worker_id) {
|
||||
Timer::clearAll();
|
||||
foreach($server->connections as $v) {
|
||||
$server->close($v);
|
||||
Console::info("Closing connection #".$v);
|
||||
foreach((LightCacheInside::get("wait_api", "wait_api") ?? []) as $v) {
|
||||
if (($v["worker_id"] ?? -1) == $worker_id && isset($v["coroutine"])) {
|
||||
Coroutine::resume($v["coroutine"]);
|
||||
}
|
||||
}
|
||||
Console::info("正在结束 Worker #".$worker_id.",进程内可能有事务在运行...");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user