From 29977fa2d6da4f0b7a1b5f13ac3f402ef139e1f3 Mon Sep 17 00:00:00 2001 From: inhere Date: Sun, 13 Sep 2020 18:16:52 +0800 Subject: [PATCH] add comments for process pool --- .../src/Annotation/Mapping/Process.php | 2 +- src/process/src/AutoLoader.php | 3 ++- src/process/src/Contract/MessageInterface.php | 27 +++++++++++++++++++ src/process/src/ProcessDispatcher.php | 2 +- src/process/src/SwooleEvent.php | 9 ++++++- 5 files changed, 39 insertions(+), 4 deletions(-) create mode 100644 src/process/src/Contract/MessageInterface.php diff --git a/src/process/src/Annotation/Mapping/Process.php b/src/process/src/Annotation/Mapping/Process.php index e185e7a18..780f69992 100644 --- a/src/process/src/Annotation/Mapping/Process.php +++ b/src/process/src/Annotation/Mapping/Process.php @@ -28,7 +28,7 @@ class Process { /** - * Default + * Default run the first worker */ public const DEFAULT = -1; diff --git a/src/process/src/AutoLoader.php b/src/process/src/AutoLoader.php index e7dacf65f..feb096cca 100644 --- a/src/process/src/AutoLoader.php +++ b/src/process/src/AutoLoader.php @@ -43,7 +43,8 @@ public function beans(): array 'on' => [ SwooleEvent::WORKER_START => bean(WorkerStartListener::class), SwooleEvent::WORKER_STOP => bean(WorkerStopListener::class) - ] + ], + 'workerNum' => 2, ] ]; } diff --git a/src/process/src/Contract/MessageInterface.php b/src/process/src/Contract/MessageInterface.php new file mode 100644 index 000000000..d013764cb --- /dev/null +++ b/src/process/src/Contract/MessageInterface.php @@ -0,0 +1,27 @@ + WorkerStartInterface::class, - self::WORKER_STOP => WorkerStopInterface::class + self::WORKER_STOP => WorkerStopInterface::class, + self::MESSAGE => MessageInterface::class ]; }