改名
This commit is contained in:
@@ -17,18 +17,10 @@ class OnTaskerStart extends WorkerStart implements EventDispatcherInterface
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @throws ConfigException
|
|
||||||
*/
|
*/
|
||||||
public function dispatch(object $event)
|
public function dispatch(object $event)
|
||||||
{
|
{
|
||||||
$time = microtime(true);
|
|
||||||
|
|
||||||
ServerManager::setEnv('environmental', Kiri::TASK);
|
ServerManager::setEnv('environmental', Kiri::TASK);
|
||||||
// if (!is_enable_file_modification_listening()) {
|
|
||||||
// $this->interpretDirectory();
|
|
||||||
// }
|
|
||||||
|
|
||||||
$this->mixed($event, false, $time);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -21,19 +21,11 @@ class OnWorkerStart extends WorkerStart implements EventDispatcherInterface
|
|||||||
/**
|
/**
|
||||||
* @param object $event
|
* @param object $event
|
||||||
* @return void
|
* @return void
|
||||||
* @throws ConfigException
|
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
public function dispatch(object $event)
|
public function dispatch(object $event)
|
||||||
{
|
{
|
||||||
$time = microtime(true);
|
|
||||||
|
|
||||||
ServerManager::setEnv('environmental', Kiri::WORKER);
|
ServerManager::setEnv('environmental', Kiri::WORKER);
|
||||||
// if (is_enable_file_modification_listening()) {
|
|
||||||
// $this->router->read_files();
|
|
||||||
// $this->interpretDirectory();
|
|
||||||
// }
|
|
||||||
$this->mixed($event, true, $time);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,47 +28,6 @@ class WorkerStart
|
|||||||
public Router $router;
|
public Router $router;
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @throws \ReflectionException
|
|
||||||
* @throws \Exception
|
|
||||||
*/
|
|
||||||
protected function interpretDirectory()
|
|
||||||
{
|
|
||||||
$di = Kiri::getDi();
|
|
||||||
|
|
||||||
$this->annotation->read(APP_PATH . 'app', 'App');
|
|
||||||
|
|
||||||
$fileLists = $this->annotation->read(APP_PATH . 'app');
|
|
||||||
foreach ($fileLists->runtime(APP_PATH . 'app') as $class) {
|
|
||||||
foreach (NoteManager::getTargetNote($class) as $value) {
|
|
||||||
$value->execute($class);
|
|
||||||
}
|
|
||||||
$methods = $di->getMethodAttribute($class);
|
|
||||||
foreach ($methods as $method => $attribute) {
|
|
||||||
if (empty($attribute)) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
foreach ($attribute as $item) {
|
|
||||||
$item->execute($class, $method);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param $event
|
|
||||||
* @param $isWorker
|
|
||||||
* @param $time
|
|
||||||
* @throws ConfigException
|
|
||||||
*/
|
|
||||||
protected function mixed($event, $isWorker, $time)
|
|
||||||
{
|
|
||||||
$name = Config::get('id', 'system-service');
|
|
||||||
echo sprintf("\033[36m[" . date('Y-m-d H:i:s') . "]\033[0m [%s]Builder %s[%d].%d use time %s.", $name, $isWorker ? 'Worker' : 'Taker',
|
|
||||||
$event->server->worker_pid, $event->workerId, round(microtime(true) - $time, 6) . 's') . PHP_EOL;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param $prefix
|
* @param $prefix
|
||||||
* @throws ConfigException
|
* @throws ConfigException
|
||||||
|
|||||||
Reference in New Issue
Block a user