mirror of
https://gitee.com/hyperf/hyperf.git
synced 2024-11-29 18:27: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.
|
- [#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.
|
- [#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
|
# v2.0.22 - 2020-12-07
|
||||||
|
|
||||||
|
@ -209,18 +209,24 @@ class Server implements ServerInterface
|
|||||||
|
|
||||||
protected function defaultCallbacks()
|
protected function defaultCallbacks()
|
||||||
{
|
{
|
||||||
$hasCallback = class_exists(Bootstrap\StartCallback::class) &&
|
$hasCallback = class_exists(Bootstrap\StartCallback::class)
|
||||||
class_exists(Bootstrap\ManagerStartCallback::class) &&
|
&& class_exists(Bootstrap\ManagerStartCallback::class)
|
||||||
class_exists(Bootstrap\WorkerStartCallback::class);
|
&& class_exists(Bootstrap\WorkerStartCallback::class);
|
||||||
|
|
||||||
if ($hasCallback) {
|
if ($hasCallback) {
|
||||||
return [
|
$callbacks = [
|
||||||
SwooleEvent::ON_START => [Bootstrap\StartCallback::class, 'onStart'],
|
|
||||||
SwooleEvent::ON_MANAGER_START => [Bootstrap\ManagerStartCallback::class, 'onManagerStart'],
|
SwooleEvent::ON_MANAGER_START => [Bootstrap\ManagerStartCallback::class, 'onManagerStart'],
|
||||||
SwooleEvent::ON_WORKER_START => [Bootstrap\WorkerStartCallback::class, 'onWorkerStart'],
|
SwooleEvent::ON_WORKER_START => [Bootstrap\WorkerStartCallback::class, 'onWorkerStart'],
|
||||||
SwooleEvent::ON_WORKER_STOP => [Bootstrap\WorkerStopCallback::class, 'onWorkerStop'],
|
SwooleEvent::ON_WORKER_STOP => [Bootstrap\WorkerStopCallback::class, 'onWorkerStop'],
|
||||||
SwooleEvent::ON_WORKER_EXIT => [Bootstrap\WorkerExitCallback::class, 'onWorkerExit'],
|
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 [
|
return [
|
||||||
|
Loading…
Reference in New Issue
Block a user