Skip to content

Commit

Permalink
区别worker和task进程
Browse files Browse the repository at this point in the history
  • Loading branch information
longxinH committed May 8, 2018
1 parent 5ef4085 commit 4ca0b35
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/Server.php
Original file line number Diff line number Diff line change
Expand Up @@ -601,9 +601,13 @@ public function onManagerStop(swoole_server $server)
*/
public function onWorkerStart(swoole_server $server, $worker_id)
{
process_rename($this->getName() . ' worker');

$this->output->writeln(sprintf('Server Worker[<info>%s</info>] is started [<info>%s</info>]', $server->worker_pid, $worker_id), OutputInterface::VERBOSITY_DEBUG);
if ($server->taskworker) {
process_rename($this->getName() . ' task');
$this->output->write(sprintf('Server Task[<info>%s</info>] is started [<info>%s</info>]', $server->worker_pid, $worker_id) . PHP_EOL);
} else {
process_rename($this->getName() . ' worker');
$this->output->write(sprintf('Server Worker[<info>%s</info>] is started [<info>%s</info>]', $server->worker_pid, $worker_id) . PHP_EOL);
}
}

/**
Expand Down

0 comments on commit 4ca0b35

Please sign in to comment.