This commit is contained in:
2021-01-04 17:16:54 +08:00
parent 0d848dc5f1
commit 2d97c3fe92
4 changed files with 4 additions and 0 deletions
+1
View File
@@ -30,6 +30,7 @@ class DatabasesProviders extends Providers
$event = Snowflake::app()->getEvent();
$event->on(Event::SERVER_WORKER_START, [$this, 'createPool']);
$event->on(Event::SERVER_TASK_START, [$this, 'createPool']);
}
+1
View File
@@ -35,6 +35,7 @@ class OnWorkerStart extends Callback
swoole_set_process_name($get_name);
}
if ($worker_id >= $server->setting['worker_num']) {
fire(Event::SERVER_TASK_START);
return;
}
Snowflake::setWorkerId($server->worker_pid);
+1
View File
@@ -39,6 +39,7 @@ class Redis extends Component
$event->on(Event::RELEASE_ALL, [$this, 'destroy']);
$event->on(Event::EVENT_AFTER_REQUEST, [$this, 'release']);
$event->on(Event::SERVER_WORKER_START, [$this, 'createPool']);
$event->on(Event::SERVER_TASK_START, [$this, 'createPool']);
}
+1
View File
@@ -43,6 +43,7 @@ class Event extends BaseObject
const SERVER_MANAGER_STOP = 'SERVER:EVENT:MANAGER:START';
const SERVER_WORKER_STOP = 'SERVER:EVENT:WORKER:STOP';
const SERVER_WORKER_START = 'SERVER:EVENT:WORKER:START';
const SERVER_TASK_START = 'SERVER:EVENT:TASK:START';
const SERVER_WORKER_EXIT = 'SERVER:EVENT:WORKER:EXIT';
const SERVER_WORKER_ERROR = 'SERVER:EVENT:WORKER:ERROR';
const SERVER_SHUTDOWN = 'SERVER:EVENT:SHUTDOWN';