Files
zhamao-framework/src/ZM/Event/SwooleEvent/OnBeforeReload.php
jerry 6b872c6f74 update to 2.4.3 version (build 403)
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
2021-03-29 15:34:24 +08:00

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);
}
}