@@ -149,24 +149,24 @@ discard block |
||
| 149 | 149 | |
| 150 | 150 | if (getmypid() === $this->ownerPid) { |
| 151 | 151 | // owner |
| 152 | - $this->log->info('pid: ' . getmypid()); |
|
| 152 | + $this->log->info('pid: '.getmypid()); |
|
| 153 | 153 | |
| 154 | 154 | return $this->masterPid; |
| 155 | 155 | } else { |
| 156 | 156 | // master |
| 157 | 157 | $taskQueue = new TaskQueue($this->ownerPid); |
| 158 | 158 | $activeWorkerSet = new ActiveWorkerSet(); |
| 159 | - $this->log->info('pid: ' . $this->masterPid); |
|
| 159 | + $this->log->info('pid: '.$this->masterPid); |
|
| 160 | 160 | |
| 161 | 161 | $log = $this->log; |
| 162 | 162 | foreach ($this->signals as $sig) { |
| 163 | - $this->pcntl->signal($sig, function ($sig) use ($log, $activeWorkerSet) { |
|
| 164 | - $log->info('received signal: ' . $sig); |
|
| 163 | + $this->pcntl->signal($sig, function($sig) use ($log, $activeWorkerSet) { |
|
| 164 | + $log->info('received signal: '.$sig); |
|
| 165 | 165 | |
| 166 | 166 | if ($activeWorkerSet->count() === 0) { |
| 167 | 167 | $log->info('no worker is active.'); |
| 168 | 168 | } else { |
| 169 | - $log->info('------> sending signal to workers. signal: ' . $sig); |
|
| 169 | + $log->info('------> sending signal to workers. signal: '.$sig); |
|
| 170 | 170 | $activeWorkerSet->terminate($sig); |
| 171 | 171 | $log->info('<------ sent signal'); |
| 172 | 172 | } |
@@ -175,7 +175,7 @@ discard block |
||
| 175 | 175 | } |
| 176 | 176 | |
| 177 | 177 | while ($task = $taskQueue->dequeue()) { |
| 178 | - $this->log->info('dequeued task #' . $taskQueue->dequeuedCount()); |
|
| 178 | + $this->log->info('dequeued task #'.$taskQueue->dequeuedCount()); |
|
| 179 | 179 | if ($activeWorkerSet->count() >= $this->concurrency) { |
| 180 | 180 | $status = null; |
| 181 | 181 | $workerPid = $this->pcntl->waitpid(-1, $status); |
@@ -209,11 +209,11 @@ discard block |
||
| 209 | 209 | |
| 210 | 210 | if (getmypid() === $this->masterPid) { |
| 211 | 211 | // master |
| 212 | - $this->log->info('forked worker. pid: ' . $worker->getPid()); |
|
| 212 | + $this->log->info('forked worker. pid: '.$worker->getPid()); |
|
| 213 | 213 | return $worker; |
| 214 | 214 | } else { |
| 215 | 215 | // worker |
| 216 | - $this->log->info('has forked. pid: ' . getmypid()); |
|
| 216 | + $this->log->info('has forked. pid: '.getmypid()); |
|
| 217 | 217 | // @codeCoverageIgnoreStart |
| 218 | 218 | |
| 219 | 219 | foreach ($this->signals as $sig) { |
@@ -223,7 +223,7 @@ discard block |
||
| 223 | 223 | $worker->setResultQueue(new ResultQueue($this->ownerPid)); |
| 224 | 224 | |
| 225 | 225 | $resultHasQueued = false; |
| 226 | - register_shutdown_function(function () use (&$resultHasQueued, $worker) { |
|
| 226 | + register_shutdown_function(function() use (&$resultHasQueued, $worker) { |
|
| 227 | 227 | if (!$resultHasQueued) { |
| 228 | 228 | $worker->error(); |
| 229 | 229 | } |
@@ -260,13 +260,13 @@ discard block |
||
| 260 | 260 | */ |
| 261 | 261 | public function sendSignalToMaster($sig = SIGTERM) |
| 262 | 262 | { |
| 263 | - $this->log->info('----> sending signal to master. signal: ' . $sig); |
|
| 263 | + $this->log->info('----> sending signal to master. signal: '.$sig); |
|
| 264 | 264 | posix_kill($this->masterPid, $sig); |
| 265 | 265 | $this->log->info('<---- sent signal.'); |
| 266 | 266 | |
| 267 | 267 | $status = null; |
| 268 | 268 | $this->pcntl->waitpid($this->masterPid, $status); |
| 269 | - $this->log->info('. status: ' . $status); |
|
| 269 | + $this->log->info('. status: '.$status); |
|
| 270 | 270 | $this->masterPid = null; |
| 271 | 271 | } |
| 272 | 272 | |