@@ -144,7 +144,7 @@ discard block |
||
144 | 144 | |
145 | 145 | if ($pid) { |
146 | 146 | // owner |
147 | - $this->log->info('pid: ' . getmypid()); |
|
147 | + $this->log->info('pid: '.getmypid()); |
|
148 | 148 | |
149 | 149 | return $this->masterPid; |
150 | 150 | } elseif ($pid === -1) { |
@@ -153,15 +153,15 @@ discard block |
||
153 | 153 | // master |
154 | 154 | $taskQueue = new TaskQueue($this->ownerPid); |
155 | 155 | $activeWorderSet = new ActiveWorkerSet(); |
156 | - $this->log->info('pid: ' . $this->masterPid); |
|
156 | + $this->log->info('pid: '.$this->masterPid); |
|
157 | 157 | |
158 | 158 | $log = $this->log; |
159 | 159 | $pcntl = $this->pcntl; |
160 | 160 | foreach ($this->signals as $sig) { |
161 | - $this->pcntl->signal($sig, function ($sig) use ($log, $pcntl, $activeWorderSet) { |
|
162 | - $log->info('received signal: ' . $sig); |
|
161 | + $this->pcntl->signal($sig, function($sig) use ($log, $pcntl, $activeWorderSet) { |
|
162 | + $log->info('received signal: '.$sig); |
|
163 | 163 | foreach ($activeWorderSet->toArray() as $worker) { |
164 | - $log->info('------> sending signal to worker. signal: ' . $sig); |
|
164 | + $log->info('------> sending signal to worker. signal: '.$sig); |
|
165 | 165 | posix_kill($worker->getPid(), $sig); |
166 | 166 | $log->info('<------ sent signal'); |
167 | 167 | $status = null; |
@@ -172,7 +172,7 @@ discard block |
||
172 | 172 | } |
173 | 173 | |
174 | 174 | while ($task = $taskQueue->dequeue()) { |
175 | - $this->log->info('dequeued task #' . $taskQueue->dequeuedCount()); |
|
175 | + $this->log->info('dequeued task #'.$taskQueue->dequeuedCount()); |
|
176 | 176 | if ($activeWorderSet->count() >= $this->concurrency) { |
177 | 177 | $status = null; |
178 | 178 | $workerPid = $this->pcntl->waitpid(-1, $status); |
@@ -206,11 +206,11 @@ discard block |
||
206 | 206 | |
207 | 207 | if (getmypid() === $this->masterPid) { |
208 | 208 | // master |
209 | - $this->log->info('forked worker. pid: ' . $worker->getPid()); |
|
209 | + $this->log->info('forked worker. pid: '.$worker->getPid()); |
|
210 | 210 | return $worker; |
211 | 211 | } else { |
212 | 212 | // worker |
213 | - $this->log->info('has forked. pid: ' . getmypid()); |
|
213 | + $this->log->info('has forked. pid: '.getmypid()); |
|
214 | 214 | // @codeCoverageIgnoreStart |
215 | 215 | |
216 | 216 | foreach ($this->signals as $sig) { |
@@ -220,7 +220,7 @@ discard block |
||
220 | 220 | $worker->setResultQueue(new ResultQueue($this->ownerPid)); |
221 | 221 | |
222 | 222 | $resultHasQueued = false; |
223 | - register_shutdown_function(function () use (&$resultHasQueued, $worker) { |
|
223 | + register_shutdown_function(function() use (&$resultHasQueued, $worker) { |
|
224 | 224 | if (!$resultHasQueued) { |
225 | 225 | $worker->error(); |
226 | 226 | } |
@@ -257,13 +257,13 @@ discard block |
||
257 | 257 | */ |
258 | 258 | public function sendSignalToMaster($sig = SIGTERM) |
259 | 259 | { |
260 | - $this->log->info('----> sending signal to master. signal: ' . $sig); |
|
260 | + $this->log->info('----> sending signal to master. signal: '.$sig); |
|
261 | 261 | posix_kill($this->masterPid, $sig); |
262 | 262 | $this->log->info('<---- sent signal.'); |
263 | 263 | |
264 | 264 | $status = null; |
265 | 265 | $this->pcntl->waitpid($this->masterPid, $status); |
266 | - $this->log->info('. status: ' . $status); |
|
266 | + $this->log->info('. status: '.$status); |
|
267 | 267 | $this->masterPid = null; |
268 | 268 | } |
269 | 269 |