mirror of
https://github.com/zhamao-robot/zhamao-framework.git
synced 2026-07-09 01:35:35 +08:00
add config: swoole.max_wait_time (default 5) add constant MAIN_WORKER add getExpireTS() for LightCache fix savePersistence() bug add zm_go() to prevent errors
26 lines
566 B
PHP
26 lines
566 B
PHP
<?php
|
|
|
|
|
|
namespace ZM\Event\SwooleEvent;
|
|
|
|
|
|
use Swoole\Process;
|
|
use ZM\Annotation\Swoole\SwooleHandler;
|
|
use ZM\Console\Console;
|
|
use ZM\Event\SwooleEvent;
|
|
|
|
/**
|
|
* Class OnBeforeReload
|
|
* @package ZM\Event\SwooleEvent
|
|
* @SwooleHandler("BeforeReload")
|
|
*/
|
|
class OnBeforeReload implements SwooleEvent
|
|
{
|
|
public function onCall() {
|
|
Console::info(Console::setColor("Reloading server...", "gold"));
|
|
for ($i = 0; $i < ZM_WORKER_NUM; ++$i) {
|
|
Process::kill(zm_atomic("_#worker_".$i)->get(), SIGUSR1);
|
|
}
|
|
usleep(800 * 1000);
|
|
}
|
|
} |