改名
This commit is contained in:
@@ -24,13 +24,8 @@ class OnBeforeReload extends Callback
|
||||
*/
|
||||
public function onHandler(Server $server)
|
||||
{
|
||||
Timer::clearAll();
|
||||
|
||||
$event = Snowflake::app()->getEvent();
|
||||
$event->trigger(Event::SERVER_BEFORE_RELOAD, [$server]);
|
||||
|
||||
$this->clearMysqlClient();
|
||||
$this->clearRedisClient();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -23,6 +23,8 @@ class OnWorkerExit extends Callback
|
||||
*/
|
||||
public function onHandler($server, $worker_id)
|
||||
{
|
||||
putenv('state=exit');
|
||||
|
||||
$event = Snowflake::app()->getEvent();
|
||||
$event->trigger(Event::SERVER_WORKER_EXIT);
|
||||
$event->offName(Event::SERVER_WORKER_EXIT);
|
||||
|
||||
@@ -38,6 +38,7 @@ class OnWorkerStart extends Callback
|
||||
public function onHandler(Server $server, int $worker_id): void
|
||||
{
|
||||
putenv('worker=' . $worker_id);
|
||||
putenv('state=start');
|
||||
|
||||
if ($worker_id >= $server->setting['worker_num']) {
|
||||
$this->onTask($server, $worker_id);
|
||||
|
||||
@@ -51,6 +51,10 @@ abstract class Pool extends Component
|
||||
*/
|
||||
public function Heartbeat_detection()
|
||||
{
|
||||
if (env('state') == 'exit') {
|
||||
$this->flush(0);
|
||||
return;
|
||||
}
|
||||
if ($this->lastTime == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -43,6 +43,9 @@ class Application extends BaseApplication
|
||||
public string $id = 'uniqueId';
|
||||
|
||||
|
||||
public string $state = '';
|
||||
|
||||
|
||||
/**
|
||||
* @throws NotFindClassException
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user