Skip to content

Commit

Permalink
Merge pull request #8 from longxinH/master
Browse files Browse the repository at this point in the history
优化Task进程判断代码
  • Loading branch information
JanHuang committed May 8, 2018
2 parents 7ad87c7 + a91d835 commit c7ac437
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions src/Server.php
Original file line number Diff line number Diff line change
Expand Up @@ -601,13 +601,9 @@ public function onManagerStop(swoole_server $server)
*/
public function onWorkerStart(swoole_server $server, $worker_id)
{
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);
}
$worker_name = $server->taskworker ? 'task' : 'worker';
process_rename($this->getName() . ' ' . $worker_name);
$this->output->write(sprintf('Server %s[<info>%s</info>] is started [<info>%s</info>]', ucfirst($worker_name), $server->worker_pid, $worker_id) . PHP_EOL);
}

/**
Expand Down

0 comments on commit c7ac437

Please sign in to comment.