@@ -19,7 +19,6 @@ discard block |
||
19 | 19 | /** |
20 | 20 | * @param callable $callable |
21 | 21 | * @param array $args |
22 | - * @param string $string |
|
23 | 22 | */ |
24 | 23 | public function __construct($callable, $args, $tag) |
25 | 24 | { |
@@ -45,7 +44,7 @@ discard block |
||
45 | 44 | } |
46 | 45 | |
47 | 46 | /** |
48 | - * @return string|null |
|
47 | + * @return string |
|
49 | 48 | */ |
50 | 49 | public function getTag() |
51 | 50 | { |
@@ -53,7 +52,7 @@ discard block |
||
53 | 52 | } |
54 | 53 | |
55 | 54 | /** |
56 | - * @return Ackintosh\Snidel\Result\Result |
|
55 | + * @return Result |
|
57 | 56 | */ |
58 | 57 | public function execute() |
59 | 58 | { |
@@ -64,8 +64,8 @@ discard block |
||
64 | 64 | foreach ($this->signals as $sig) { |
65 | 65 | $this->pcntl->signal( |
66 | 66 | $sig, |
67 | - function ($sig) use($log, $self) { |
|
68 | - $log->info('received signal. signo: ' . $sig); |
|
67 | + function($sig) use($log, $self) { |
|
68 | + $log->info('received signal. signo: '.$sig); |
|
69 | 69 | $self->setReceivedSignal($sig); |
70 | 70 | |
71 | 71 | $log->info('--> sending a signal to children.'); |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | ); |
78 | 78 | } |
79 | 79 | |
80 | - $this->log->info('parent pid: ' . $this->ownerPid); |
|
80 | + $this->log->info('parent pid: '.$this->ownerPid); |
|
81 | 81 | } |
82 | 82 | |
83 | 83 | /** |
@@ -115,7 +115,7 @@ discard block |
||
115 | 115 | throw $e; |
116 | 116 | } |
117 | 117 | |
118 | - $this->log->info('queued task #' . $this->forkContainer->queuedCount()); |
|
118 | + $this->log->info('queued task #'.$this->forkContainer->queuedCount()); |
|
119 | 119 | } |
120 | 120 | |
121 | 121 | /** |
@@ -142,7 +142,7 @@ discard block |
||
142 | 142 | |
143 | 143 | if (getmypid() === $this->ownerPid) { |
144 | 144 | // parent |
145 | - $this->log->info('created child process. pid: ' . $fork->getPid()); |
|
145 | + $this->log->info('created child process. pid: '.$fork->getPid()); |
|
146 | 146 | } else { |
147 | 147 | // @codeCoverageIgnoreStart |
148 | 148 | // child |
@@ -155,7 +155,7 @@ discard block |
||
155 | 155 | */ |
156 | 156 | $log = $this->log; |
157 | 157 | $resultHasWritten = false; |
158 | - register_shutdown_function(function () use (&$resultHasWritten, $fork, $task, $log, $token) { |
|
158 | + register_shutdown_function(function() use (&$resultHasWritten, $fork, $task, $log, $token) { |
|
159 | 159 | if (!$resultHasWritten) { |
160 | 160 | $dataRepository = new DataRepository(); |
161 | 161 | $data = $dataRepository->load(getmypid()); |
@@ -237,7 +237,7 @@ discard block |
||
237 | 237 | $this->wait(); |
238 | 238 | } |
239 | 239 | if ($tag !== null && !$this->forkContainer->hasTag($tag)) { |
240 | - throw new \InvalidArgumentException('unknown tag: ' . $tag); |
|
240 | + throw new \InvalidArgumentException('unknown tag: '.$tag); |
|
241 | 241 | } |
242 | 242 | |
243 | 243 | return $this->forkContainer->getCollection($tag); |
@@ -252,7 +252,7 @@ discard block |
||
252 | 252 | public function sendSignalToChildren($sig) |
253 | 253 | { |
254 | 254 | foreach ($this->forkContainer->getChildPids() as $pid) { |
255 | - $this->log->info('----> sending a signal to child. pid: ' . $pid); |
|
255 | + $this->log->info('----> sending a signal to child. pid: '.$pid); |
|
256 | 256 | posix_kill($pid, $sig); |
257 | 257 | } |
258 | 258 | } |
@@ -353,7 +353,7 @@ discard block |
||
353 | 353 | |
354 | 354 | $childPid = $result->getFork()->getPid(); |
355 | 355 | if ($result->isFailure()) { |
356 | - $message = 'an error has occurred in child process. pid: ' . $childPid; |
|
356 | + $message = 'an error has occurred in child process. pid: '.$childPid; |
|
357 | 357 | $this->log->error($message); |
358 | 358 | throw new \RuntimeException($message); |
359 | 359 | } |
@@ -139,7 +139,7 @@ discard block |
||
139 | 139 | |
140 | 140 | if ($pid) { |
141 | 141 | // owner |
142 | - $this->log->info('pid: ' . getmypid()); |
|
142 | + $this->log->info('pid: '.getmypid()); |
|
143 | 143 | |
144 | 144 | return $this->masterPid; |
145 | 145 | } elseif ($pid === -1) { |
@@ -147,7 +147,7 @@ discard block |
||
147 | 147 | } else { |
148 | 148 | // master |
149 | 149 | $taskQueue = new TaskQueue($this->ownerPid); |
150 | - $this->log->info('pid: ' . $this->masterPid); |
|
150 | + $this->log->info('pid: '.$this->masterPid); |
|
151 | 151 | |
152 | 152 | foreach ($this->signals as $sig) { |
153 | 153 | $this->pcntl->signal($sig, SIG_DFL, true); |
@@ -155,7 +155,7 @@ discard block |
||
155 | 155 | $workerCount = 0; |
156 | 156 | |
157 | 157 | while ($task = $taskQueue->dequeue()) { |
158 | - $this->log->info('dequeued task #' . $taskQueue->dequeuedCount()); |
|
158 | + $this->log->info('dequeued task #'.$taskQueue->dequeuedCount()); |
|
159 | 159 | if ($workerCount >= $this->concurrency) { |
160 | 160 | $status = null; |
161 | 161 | $this->pcntl->waitpid(-1, $status); |
@@ -186,10 +186,10 @@ discard block |
||
186 | 186 | |
187 | 187 | if (getmypid() === $this->masterPid) { |
188 | 188 | // master |
189 | - $this->log->info('forked worker. pid: ' . $fork->getPid()); |
|
189 | + $this->log->info('forked worker. pid: '.$fork->getPid()); |
|
190 | 190 | } else { |
191 | 191 | // worker |
192 | - $this->log->info('has forked. pid: ' . getmypid()); |
|
192 | + $this->log->info('has forked. pid: '.getmypid()); |
|
193 | 193 | // @codeCoverageIgnoreStart |
194 | 194 | |
195 | 195 | foreach ($this->signals as $sig) { |
@@ -198,7 +198,7 @@ discard block |
||
198 | 198 | |
199 | 199 | $resultQueue = new ResultQueue($this->ownerPid); |
200 | 200 | $resultHasQueued = false; |
201 | - register_shutdown_function(function () use (&$resultHasQueued, $fork, $task, $resultQueue) { |
|
201 | + register_shutdown_function(function() use (&$resultHasQueued, $fork, $task, $resultQueue) { |
|
202 | 202 | if (!$resultHasQueued) { |
203 | 203 | $result = new Result(); |
204 | 204 | $result->setFailure(); |