@@ -25,7 +25,7 @@ public static function isStopping(): bool {
2525 'task_ipc_mode ' => 1 , // 3为使用消息队列通信,争抢模式,无法使用定向投递
2626 'task_max_request ' => 5000 , // task进程处理200个请求后自动退出,防止内存溢出
2727 'backlog ' => 128 , // 最多同时有多少个等待accept的连接
28- 'pid_file ' => \Swango \Environment::getDir ()->base . ' wmp .pid ' ,
28+ 'pid_file ' => \Swango \Environment::getDir ()->base . \ Swango \Environment:: getName () . ' .pid ' ,
2929 'max_request ' => 0 , // worker永不退出
3030 'reload_async ' => true ,
3131 'http_parse_post ' => false , // 不自动解析POST包体
@@ -124,7 +124,7 @@ public function start($daemonize = false): void {
124124 $ this ->server ->start ();
125125 }
126126 public function getPid (): ?int {
127- $ pidfile = \Swango \Environment::getDir ()->base . ' wmp .pid ' ;
127+ $ pidfile = \Swango \Environment::getDir ()->base . \ Swango \Environment:: getName () . ' .pid ' ;
128128 if (file_exists ($ pidfile )) {
129129 $ pid = file_get_contents ($ pidfile );
130130 return $ pid && @posix_kill ($ pid , 0 ) ? $ pid : null ;
@@ -179,10 +179,10 @@ public function talk(array $cmds, string $host = '127.0.0.1', int $port = 8588):
179179 $ client ->close ();
180180 }
181181 public function onStart (\Swoole \Server $ server ): void {
182- @cli_set_process_title (' Wmp master ' );
182+ @cli_set_process_title (\ Swango \Environment:: getName () . ' master ' );
183183 }
184184 public function onManagerStart (\Swoole \Server $ server ): void {
185- @cli_set_process_title (' Wmp manager ' );
185+ @cli_set_process_title (\ Swango \Environment:: getName () . ' manager ' );
186186 }
187187 private function onTaskStart (\Swoole \Server $ serv , $ worker_id ): void {
188188 define ('SWANGO_WORKING_IN_TASK ' , true );
@@ -211,11 +211,11 @@ public function onAllWorkerStart(\Swoole\Server $serv, $worker_id): void {
211211 self ::$ worker = $ serv ;
212212 self ::$ worker_id = $ worker_id ;
213213 if ($ worker_id < $ this ->swoole_server_config ['worker_num ' ]) {
214- @cli_set_process_title (' Wmp worker ' . $ worker_id );
214+ @cli_set_process_title (\ Swango \Environment:: getName () . ' worker ' . $ worker_id );
215215 $ this ->onWorkerStart ($ serv , $ worker_id );
216216 } else {
217217 $ this ->onTaskStart ($ serv , $ worker_id );
218- @cli_set_process_title (' Wmp task ' . $ worker_id );
218+ @cli_set_process_title (\ Swango \Environment:: getName () . ' task ' . $ worker_id );
219219 }
220220 }
221221 private function recycle (): void {
@@ -241,14 +241,14 @@ public function onWorkerError(\Swoole\Server $serv, $worker_id, $worker_pid, $ex
241241 public function onWorkerStop (\Swoole \Server $ serv , $ worker_id ): void {
242242 if (! $ this ->stopping_process_title_set ) {
243243 $ this ->stopping_process_title_set = true ;
244- @cli_set_process_title (' Wmp worker ' . $ worker_id . ' [stopping] ' );
244+ @cli_set_process_title (\ Swango \Environment:: getName () . ' worker ' . $ worker_id . ' [stopping] ' );
245245 }
246246 $ this ->recycle ();
247247 }
248248 public function onWorkerExit (\Swoole \Server $ serv , $ worker_id ): void {
249249 if (! $ this ->stopping_process_title_set ) {
250250 $ this ->stopping_process_title_set = true ;
251- @cli_set_process_title (' Wmp worker ' . $ worker_id . ' [stopping] ' );
251+ @cli_set_process_title (\ Swango \Environment:: getName () . ' worker ' . $ worker_id . ' [stopping] ' );
252252 }
253253 $ this ->recycle ();
254254 }
0 commit comments