@@ -80,7 +80,7 @@ |
||
| 80 | 80 | } |
| 81 | 81 | |
| 82 | 82 | $format = $this->getDateFormat($type); |
| 83 | - usort($timingsDates, function ($date1str, $date2str) use ($format) { |
|
| 83 | + usort($timingsDates, function($date1str, $date2str) use ($format) { |
|
| 84 | 84 | $date1 = \DateTime::createFromFormat($format, $date1str); |
| 85 | 85 | $date2 = \DateTime::createFromFormat($format, $date2str); |
| 86 | 86 | if (!$date2) { |
@@ -36,7 +36,7 @@ |
||
| 36 | 36 | $total += count($this->jobs[$jobWorkerName]); |
| 37 | 37 | } |
| 38 | 38 | |
| 39 | - return array_sum(array_map(function ($jobs) { |
|
| 39 | + return array_sum(array_map(function($jobs) { |
|
| 40 | 40 | return count($jobs); |
| 41 | 41 | }, $this->jobs)); |
| 42 | 42 | } |
@@ -286,7 +286,7 @@ |
||
| 286 | 286 | self::assertEquals(1, $count); |
| 287 | 287 | $allCount = $this->runCountQuery($jobManager->getJobClass()); |
| 288 | 288 | $counter = 0; |
| 289 | - $countJobs = function ($count) use (&$counter) { |
|
| 289 | + $countJobs = function($count) use (&$counter) { |
|
| 290 | 290 | $counter += $count; |
| 291 | 291 | }; |
| 292 | 292 | $jobManager->archiveAllJobs(null, null, $countJobs); |
@@ -148,6 +148,7 @@ discard block |
||
| 148 | 148 | /** |
| 149 | 149 | * @param string $crcCacheKey |
| 150 | 150 | * @param int|null $newFoundPriority |
| 151 | + * @param string $foundJobCacheKey |
|
| 151 | 152 | */ |
| 152 | 153 | protected function finishBatchFoundJob(Job $foundJob, $foundJobCacheKey, $crcCacheKey, $newFoundWhen, $newFoundPriority) |
| 153 | 154 | { |
@@ -170,6 +171,7 @@ discard block |
||
| 170 | 171 | |
| 171 | 172 | /** |
| 172 | 173 | * @param bool $adjust |
| 174 | + * @param string $crcCacheKey |
|
| 173 | 175 | */ |
| 174 | 176 | protected function addFoundJob($adjust, Job $foundJob, $foundJobCacheKey, $crcCacheKey) |
| 175 | 177 | { |
@@ -268,7 +268,7 @@ discard block |
||
| 268 | 268 | ->scalarNode('alias') |
| 269 | 269 | ->defaultNull()->end() |
| 270 | 270 | ->end() |
| 271 | - ->validate()->ifTrue(function ($node) { |
|
| 271 | + ->validate()->ifTrue(function($node) { |
|
| 272 | 272 | if (isset($node['type']) && !isset($node['alias'])) { |
| 273 | 273 | return true; |
| 274 | 274 | } |
@@ -291,7 +291,7 @@ discard block |
||
| 291 | 291 | ->scalarNode('dsn')->defaultNull()->end() |
| 292 | 292 | ->append($this->addPredisArgs()) |
| 293 | 293 | ->end() |
| 294 | - ->validate()->ifTrue(function ($node) { |
|
| 294 | + ->validate()->ifTrue(function($node) { |
|
| 295 | 295 | if (isset($node['dsn']) && (isset($node['connection_parameters']['host']) || isset($node['connection_parameters']['port']))) { |
| 296 | 296 | return true; |
| 297 | 297 | } |
@@ -334,7 +334,7 @@ discard block |
||
| 334 | 334 | ->append($this->addPredis()) |
| 335 | 335 | ->append($this->addPhpRedisArgs()) |
| 336 | 336 | ->end() |
| 337 | - ->validate()->ifTrue(function ($node) { |
|
| 337 | + ->validate()->ifTrue(function($node) { |
|
| 338 | 338 | if ($this->checkPredis($node)) { |
| 339 | 339 | return true; |
| 340 | 340 | } |
@@ -362,7 +362,7 @@ discard block |
||
| 362 | 362 | ->floatNode('read_timeout')->defaultValue(0)->end() |
| 363 | 363 | ->scalarNode('auth')->end() |
| 364 | 364 | ->end() |
| 365 | - ->validate()->ifTrue(function ($node) { |
|
| 365 | + ->validate()->ifTrue(function($node) { |
|
| 366 | 366 | if (!empty($node) && !isset($node['host'])) { |
| 367 | 367 | return true; |
| 368 | 368 | } |
@@ -395,7 +395,7 @@ discard block |
||
| 395 | 395 | ->booleanNode('iterable_multibulk')->defaultFalse()->end() |
| 396 | 396 | ->booleanNode('throw_errors')->defaultTrue()->end() |
| 397 | 397 | ->end() |
| 398 | - ->validate()->ifTrue(function ($node) { |
|
| 398 | + ->validate()->ifTrue(function($node) { |
|
| 399 | 399 | if (isset($node['host']) && !isset($node['port'])) { |
| 400 | 400 | return true; |
| 401 | 401 | } |
@@ -435,7 +435,7 @@ discard block |
||
| 435 | 435 | $rootNode |
| 436 | 436 | ->prototype('variable')->end() |
| 437 | 437 | ->validate() |
| 438 | - ->ifTrue(function ($node) { |
|
| 438 | + ->ifTrue(function($node) { |
|
| 439 | 439 | if (!is_array($node)) { |
| 440 | 440 | return true; |
| 441 | 441 | } |
@@ -512,7 +512,7 @@ discard block |
||
| 512 | 512 | ->append($this->addRabbitMqArgs()) |
| 513 | 513 | ->append($this->addRabbitMqExchange()) |
| 514 | 514 | ->end() |
| 515 | - ->validate()->always(function ($node) { |
|
| 515 | + ->validate()->always(function($node) { |
|
| 516 | 516 | if (empty($node['ssl_options'])) { |
| 517 | 517 | unset($node['ssl_options']); |
| 518 | 518 | } |
@@ -522,7 +522,7 @@ discard block |
||
| 522 | 522 | |
| 523 | 523 | return $node; |
| 524 | 524 | })->end() |
| 525 | - ->validate()->ifTrue(function ($node) { |
|
| 525 | + ->validate()->ifTrue(function($node) { |
|
| 526 | 526 | if (isset($node['ssl_options']) && !$node['ssl']) { |
| 527 | 527 | return true; |
| 528 | 528 | } |
@@ -91,7 +91,7 @@ discard block |
||
| 91 | 91 | ]; |
| 92 | 92 | |
| 93 | 93 | try { |
| 94 | - $this->predis->transaction($options, function (MultiExec $tx) use ($key, &$element) { |
|
| 94 | + $this->predis->transaction($options, function(MultiExec $tx) use ($key, &$element) { |
|
| 95 | 95 | list($element) = $tx->zrange($key, 0, 0); |
| 96 | 96 | |
| 97 | 97 | if (isset($element)) { |
@@ -116,7 +116,7 @@ discard block |
||
| 116 | 116 | ]; |
| 117 | 117 | |
| 118 | 118 | try { |
| 119 | - $this->predis->transaction($options, function (MultiExec $tx) use ($key, $max, &$element) { |
|
| 119 | + $this->predis->transaction($options, function(MultiExec $tx) use ($key, $max, &$element) { |
|
| 120 | 120 | list($element) = $tx->zrangebyscore($key, 0, $max, ['LIMIT' => [0, 1]]); |
| 121 | 121 | |
| 122 | 122 | if (isset($element)) { |
@@ -207,6 +207,9 @@ |
||
| 207 | 207 | return $count; |
| 208 | 208 | } |
| 209 | 209 | |
| 210 | + /** |
|
| 211 | + * @param integer $expected |
|
| 212 | + */ |
|
| 210 | 213 | protected static function getWaitingJobCount($expected) |
| 211 | 214 | { |
| 212 | 215 | $count = self::$jobManager->getWaitingJobCount(); |
@@ -252,6 +252,9 @@ |
||
| 252 | 252 | self::$jobManager->saveHistory($jobInQueue); |
| 253 | 253 | } |
| 254 | 254 | |
| 255 | + /** |
|
| 256 | + * @param \PhpAmqpLib\Channel\AMQPChannel $channel |
|
| 257 | + */ |
|
| 255 | 258 | protected static function drainQueue($channel) |
| 256 | 259 | { |
| 257 | 260 | $drained = 0; |
@@ -26,7 +26,7 @@ |
||
| 26 | 26 | $firstJob = key($status); |
| 27 | 27 | if ($firstJob) { |
| 28 | 28 | $jobKeys = array_keys($status); |
| 29 | - $maxLength = max(array_map(function ($item) { |
|
| 29 | + $maxLength = max(array_map(function($item) { |
|
| 30 | 30 | return strlen($item ?: ''); |
| 31 | 31 | }, $jobKeys)); |
| 32 | 32 | $formatLen = $maxLength > 50 ? 50 : $maxLength; |