Files
kiri-core/http-server/Worker/OnWorkerStart.php
T
as2252258@163.com ff58d0faef 111
2021-09-19 16:42:29 +08:00

43 lines
993 B
PHP

<?php
namespace Server\Worker;
use Annotation\Annotation;
use Annotation\Inject;
use Exception;
use Http\Handler\Router;
use Kiri\Abstracts\Config;
use Kiri\Di\NoteManager;
use Kiri\Exception\ConfigException;
use Kiri\Kiri;
use Psr\EventDispatcher\EventDispatcherInterface;
use ReflectionException;
use Server\ServerManager;
class OnWorkerStart extends WorkerStart implements EventDispatcherInterface
{
/**
* @param object $event
* @return void
* @throws ConfigException
* @throws ReflectionException
* @throws Exception
*/
public function dispatch(object $event)
{
$isWorker = $event->workerId < $event->server->setting['worker_num'];
$time = microtime(true);
ServerManager::setEnv('environmental', Kiri::WORKER);
if (!is_enable_file_modification_listening()) {
$this->router->read_files();
$this->interpretDirectory();
}
$this->mixed($event, $isWorker, $time);
}
}