Skip to content

Commit 7ad87c7

Browse files
authored
Merge pull request #7 from longxinH/master
区别worker和task进程
2 parents 5ef4085 + 4ca0b35 commit 7ad87c7

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

src/Server.php

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -601,9 +601,13 @@ public function onManagerStop(swoole_server $server)
601601
*/
602602
public function onWorkerStart(swoole_server $server, $worker_id)
603603
{
604-
process_rename($this->getName() . ' worker');
605-
606-
$this->output->writeln(sprintf('Server Worker[<info>%s</info>] is started [<info>%s</info>]', $server->worker_pid, $worker_id), OutputInterface::VERBOSITY_DEBUG);
604+
if ($server->taskworker) {
605+
process_rename($this->getName() . ' task');
606+
$this->output->write(sprintf('Server Task[<info>%s</info>] is started [<info>%s</info>]', $server->worker_pid, $worker_id) . PHP_EOL);
607+
} else {
608+
process_rename($this->getName() . ' worker');
609+
$this->output->write(sprintf('Server Worker[<info>%s</info>] is started [<info>%s</info>]', $server->worker_pid, $worker_id) . PHP_EOL);
610+
}
607611
}
608612

609613
/**

0 commit comments

Comments
 (0)