This commit is contained in:
as2252258@163.com
2021-08-29 04:31:14 +08:00
parent 8c088c3384
commit 751bc7cc4a
5 changed files with 17 additions and 7 deletions
+10 -5
View File
@@ -55,12 +55,14 @@ class OnWorkerStart implements EventDispatcherInterface
/** /**
* @param $event * @param $event
* @throws \Kiri\Exception\ConfigException * @throws \Kiri\Exception\ConfigException
* @throws \Exception
*/ */
public function onTaskInit($event) public function onTaskInit($event)
{ {
$this->annotation->read(APP_PATH . 'app', 'App', [CONTROLLER_PATH]);
putenv('environmental=' . Kiri::TASK); putenv('environmental=' . Kiri::TASK);
if (is_enable_file_modification_listening()) {
$this->annotation->read(APP_PATH . 'app', 'App', [CONTROLLER_PATH]);
}
echo sprintf("\033[36m[" . date('Y-m-d H:i:s') . "]\033[0m Tasker[%d].%d start.", $event->server->worker_pid, $event->workerId) . PHP_EOL; echo sprintf("\033[36m[" . date('Y-m-d H:i:s') . "]\033[0m Tasker[%d].%d start.", $event->server->worker_pid, $event->workerId) . PHP_EOL;
@@ -75,14 +77,17 @@ class OnWorkerStart implements EventDispatcherInterface
*/ */
public function onWorkerInit($event) public function onWorkerInit($event)
{ {
$this->annotation->read(APP_PATH . 'app');
putenv('environmental=' . Kiri::WORKER); putenv('environmental=' . Kiri::WORKER);
echo sprintf("\033[36m[" . date('Y-m-d H:i:s') . "]\033[0m Worker[%d].%d start.", $event->server->worker_pid, $event->workerId) . PHP_EOL;
$this->setProcessName(sprintf('Worker[%d].%d', $event->server->worker_pid, $event->workerId));
if (is_enable_file_modification_listening()) { if (is_enable_file_modification_listening()) {
$this->annotation->read(APP_PATH . 'app');
$loader = Kiri::app()->getRouter(); $loader = Kiri::app()->getRouter();
$loader->_loader(); $loader->_loader();
} }
echo sprintf("\033[36m[" . date('Y-m-d H:i:s') . "]\033[0m Worker[%d].%d start.", $event->server->worker_pid, $event->workerId) . PHP_EOL;
$this->setProcessName(sprintf('Worker[%d].%d', $event->server->worker_pid, $event->workerId));
} }
+1
View File
@@ -32,6 +32,7 @@ use Annotation\Attribute;
/** /**
* @param static $params
* @param mixed $class * @param mixed $class
* @param mixed|null $method * @param mixed|null $method
* @return array * @return array
+1
View File
@@ -28,6 +28,7 @@ use Http\IInterface\MiddlewareInterface;
/** /**
* @param static $params
* @param mixed $class * @param mixed $class
* @param mixed|null $method * @param mixed|null $method
* @return $this * @return $this
+3 -1
View File
@@ -24,10 +24,12 @@ use Kiri\Kiri;
/** /**
* @param static $params
* @param mixed $class * @param mixed $class
* @param mixed|null $method * @param mixed|null $method
* @return Router * @return Router
* @throws Exception * @throws \Kiri\Exception\NotFindClassException
* @throws \ReflectionException
*/ */
public static function execute(mixed $params, mixed $class, mixed $method = null): Router public static function execute(mixed $params, mixed $class, mixed $method = null): Router
{ {
+1
View File
@@ -32,6 +32,7 @@ use Kiri\Kiri;
/** /**
* @param static $params
* @param mixed $class * @param mixed $class
* @param mixed|null $method * @param mixed|null $method
* @return Router * @return Router