mirror of
https://gitee.com/hyperf/hyperf.git
synced 2024-12-02 03:37:44 +08:00
Removed onStart
event from server default callbacks when the mode is SWOOLE_BASE
. (#2963)
* Optimized Server defaultCallbacks * Format code. * Update CHANGELOG-2.0.md Co-authored-by: 李铭昕 <715557344@qq.com>
This commit is contained in:
parent
28fa61c687
commit
481b3bd6ed
@ -17,6 +17,7 @@
|
||||
|
||||
- [#2951](https://github.com/hyperf/hyperf/pull/2951) Optimized code for model-cache, which will delete model cache only once, when using it in transaction.
|
||||
- [#2953](https://github.com/hyperf/hyperf/pull/2953) Hide `Swoole\ExitException` trace message in command.
|
||||
- [#2963](https://github.com/hyperf/hyperf/pull/2963) Removed `onStart` event from server default callbacks when the mode is `SWOOLE_BASE`.
|
||||
|
||||
# v2.0.22 - 2020-12-07
|
||||
|
||||
|
@ -209,18 +209,24 @@ class Server implements ServerInterface
|
||||
|
||||
protected function defaultCallbacks()
|
||||
{
|
||||
$hasCallback = class_exists(Bootstrap\StartCallback::class) &&
|
||||
class_exists(Bootstrap\ManagerStartCallback::class) &&
|
||||
class_exists(Bootstrap\WorkerStartCallback::class);
|
||||
$hasCallback = class_exists(Bootstrap\StartCallback::class)
|
||||
&& class_exists(Bootstrap\ManagerStartCallback::class)
|
||||
&& class_exists(Bootstrap\WorkerStartCallback::class);
|
||||
|
||||
if ($hasCallback) {
|
||||
return [
|
||||
SwooleEvent::ON_START => [Bootstrap\StartCallback::class, 'onStart'],
|
||||
$callbacks = [
|
||||
SwooleEvent::ON_MANAGER_START => [Bootstrap\ManagerStartCallback::class, 'onManagerStart'],
|
||||
SwooleEvent::ON_WORKER_START => [Bootstrap\WorkerStartCallback::class, 'onWorkerStart'],
|
||||
SwooleEvent::ON_WORKER_STOP => [Bootstrap\WorkerStopCallback::class, 'onWorkerStop'],
|
||||
SwooleEvent::ON_WORKER_EXIT => [Bootstrap\WorkerExitCallback::class, 'onWorkerExit'],
|
||||
];
|
||||
if ($this->server->mode === SWOOLE_BASE) {
|
||||
return $callbacks;
|
||||
}
|
||||
|
||||
return array_merge([
|
||||
SwooleEvent::ON_START => [Bootstrap\StartCallback::class, 'onStart'],
|
||||
], $callbacks);
|
||||
}
|
||||
|
||||
return [
|
||||
|
Loading…
Reference in New Issue
Block a user