2020-08-31 01:27:08 +08:00
|
|
|
<?php
|
2020-10-29 18:17:25 +08:00
|
|
|
declare(strict_types=1);
|
2020-08-31 01:27:08 +08:00
|
|
|
|
2020-09-02 11:38:47 +08:00
|
|
|
namespace HttpServer\Events;
|
2020-08-31 01:27:08 +08:00
|
|
|
|
|
|
|
|
|
2020-09-02 17:33:48 +08:00
|
|
|
use Exception;
|
2020-09-04 01:05:33 +08:00
|
|
|
use HttpServer\Abstracts\Callback;
|
2021-08-11 01:04:57 +08:00
|
|
|
use Kiri\Event;
|
|
|
|
|
use Kiri\Kiri;
|
2021-04-07 11:26:58 +08:00
|
|
|
use Swoole\Timer;
|
2020-08-31 01:27:08 +08:00
|
|
|
|
2020-09-02 17:33:48 +08:00
|
|
|
/**
|
|
|
|
|
* Class OnWorkerExit
|
|
|
|
|
* @package HttpServer\Events
|
|
|
|
|
*/
|
2020-08-31 01:27:08 +08:00
|
|
|
class OnWorkerExit extends Callback
|
|
|
|
|
{
|
|
|
|
|
|
2021-04-23 03:38:26 +08:00
|
|
|
/**
|
|
|
|
|
* @param $server
|
|
|
|
|
* @param $worker_id
|
|
|
|
|
* @throws Exception
|
|
|
|
|
*/
|
|
|
|
|
public function onHandler($server, $worker_id)
|
|
|
|
|
{
|
|
|
|
|
putenv('state=exit');
|
2021-03-31 01:36:16 +08:00
|
|
|
|
2021-07-11 03:57:25 +08:00
|
|
|
Event::trigger(Event::SERVER_WORKER_EXIT, [$server, $worker_id]);
|
2021-03-02 19:02:44 +08:00
|
|
|
|
2021-08-11 01:04:57 +08:00
|
|
|
Kiri::getApp('logger')->insert();
|
2021-07-11 03:57:25 +08:00
|
|
|
}
|
2020-08-31 01:27:08 +08:00
|
|
|
|
|
|
|
|
}
|