@@ -27,6 +27,9 @@ discard block |
||
27 | 27 | protected $hostname; |
28 | 28 | protected $pid; |
29 | 29 | |
30 | + /** |
|
31 | + * @param string $cacheKeyPrefix |
|
32 | + */ |
|
30 | 33 | public function __construct(RunManager $runManager, JobTimingManager $jobTimingManager, $jobClass, $cacheKeyPrefix) |
31 | 34 | { |
32 | 35 | $this->cacheKeyPrefix = $cacheKeyPrefix; |
@@ -46,6 +49,9 @@ discard block |
||
46 | 49 | return $this->cacheKeyPrefix.'_job_'.$jobId; |
47 | 50 | } |
48 | 51 | |
52 | + /** |
|
53 | + * @param string $jobCrc |
|
54 | + */ |
|
49 | 55 | protected function getJobCrcHashKey($jobCrc) |
50 | 56 | { |
51 | 57 | return $this->cacheKeyPrefix.'_job_crc_'.$jobCrc; |
@@ -103,6 +109,9 @@ discard block |
||
103 | 109 | return null; |
104 | 110 | } |
105 | 111 | |
112 | + /** |
|
113 | + * @param string $foundJobCacheKey |
|
114 | + */ |
|
106 | 115 | protected function batchFoundJob(\Dtc\QueueBundle\Redis\Job $job, $foundJobCacheKey, $foundJobMessage) |
107 | 116 | { |
108 | 117 | $when = $job->getWhenUs(); |
@@ -174,7 +183,7 @@ discard block |
||
174 | 183 | /** |
175 | 184 | * @param \Dtc\QueueBundle\Model\Job $job |
176 | 185 | * |
177 | - * @return \Dtc\QueueBundle\Model\Job |
|
186 | + * @return null|Job |
|
178 | 187 | * |
179 | 188 | * @throws ClassNotSubclassException |
180 | 189 | */ |
@@ -288,6 +297,9 @@ discard block |
||
288 | 297 | } |
289 | 298 | } |
290 | 299 | |
300 | + /** |
|
301 | + * @param string $workerName |
|
302 | + */ |
|
291 | 303 | protected function verifyGetJobArgs($workerName = null, $methodName = null, $prioritize = true) |
292 | 304 | { |
293 | 305 | if (null !== $workerName || null !== $methodName || (null !== $this->maxPriority && true !== $prioritize)) { |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | ]; |
71 | 71 | |
72 | 72 | try { |
73 | - $this->predis->transaction($options, function ($tx) use ($key, &$element) { |
|
73 | + $this->predis->transaction($options, function($tx) use ($key, &$element) { |
|
74 | 74 | @list($element) = $tx->zrange($key, 0, 0); |
75 | 75 | |
76 | 76 | if (isset($element)) { |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | ]; |
96 | 96 | |
97 | 97 | try { |
98 | - $this->predis->transaction($options, function ($tx) use ($key, $max, &$element) { |
|
98 | + $this->predis->transaction($options, function($tx) use ($key, $max, &$element) { |
|
99 | 99 | @list($element) = $tx->zrangebyscore($key, 0, $max, ['LIMIT' => [0, 1]]); |
100 | 100 | |
101 | 101 | if (isset($element)) { |
@@ -522,13 +522,13 @@ |
||
522 | 522 | |
523 | 523 | return $node; |
524 | 524 | })->end() |
525 | - ->validate()->ifTrue(function ($node) { |
|
526 | - if (isset($node['ssl_options']) && !$node['ssl']) { |
|
527 | - return true; |
|
528 | - } |
|
525 | + ->validate()->ifTrue(function ($node) { |
|
526 | + if (isset($node['ssl_options']) && !$node['ssl']) { |
|
527 | + return true; |
|
528 | + } |
|
529 | 529 | |
530 | - return false; |
|
531 | - })->thenInvalid('ssl must be true in order to set ssl_options')->end() |
|
530 | + return false; |
|
531 | + })->thenInvalid('ssl must be true in order to set ssl_options')->end() |
|
532 | 532 | ->end(); |
533 | 533 | |
534 | 534 | return $rootNode; |
@@ -272,7 +272,7 @@ discard block |
||
272 | 272 | ->scalarNode('alias') |
273 | 273 | ->defaultNull()->end() |
274 | 274 | ->end() |
275 | - ->validate()->ifTrue(function ($node) { |
|
275 | + ->validate()->ifTrue(function($node) { |
|
276 | 276 | if (isset($node['type']) && !isset($node['alias'])) { |
277 | 277 | return true; |
278 | 278 | } |
@@ -288,7 +288,7 @@ discard block |
||
288 | 288 | ->scalarNode('dsn')->defaultNull()->end() |
289 | 289 | ->append($this->addPredisArgs()) |
290 | 290 | ->end() |
291 | - ->validate()->ifTrue(function ($node) { |
|
291 | + ->validate()->ifTrue(function($node) { |
|
292 | 292 | if (isset($node['dsn']) && (isset($node['connection_parameters']['host']) || isset($node['connection_parameters']['port']))) { |
293 | 293 | return true; |
294 | 294 | } |
@@ -298,7 +298,7 @@ discard block |
||
298 | 298 | ->end() |
299 | 299 | ->append($this->addPhpRedisArgs()) |
300 | 300 | ->end() |
301 | - ->validate()->ifTrue(function ($node) { |
|
301 | + ->validate()->ifTrue(function($node) { |
|
302 | 302 | if ((isset($node['predis']['dsn']) || isset($node['predis']['connection_parameters']['host'])) && |
303 | 303 | (isset($node['snc_redis']['type']) || isset($node['phpredis']['host']))) { |
304 | 304 | return true; |
@@ -334,7 +334,7 @@ discard block |
||
334 | 334 | ->floatNode('read_timeout')->defaultValue(0)->end() |
335 | 335 | ->scalarNode('auth')->end() |
336 | 336 | ->end() |
337 | - ->validate()->ifTrue(function ($node) { |
|
337 | + ->validate()->ifTrue(function($node) { |
|
338 | 338 | if (!empty($node) && !isset($node['host'])) { |
339 | 339 | return true; |
340 | 340 | } |
@@ -367,7 +367,7 @@ discard block |
||
367 | 367 | ->booleanNode('iterable_multibulk')->defaultFalse()->end() |
368 | 368 | ->booleanNode('throw_errors')->defaultTrue()->end() |
369 | 369 | ->end() |
370 | - ->validate()->ifTrue(function ($node) { |
|
370 | + ->validate()->ifTrue(function($node) { |
|
371 | 371 | if (isset($node['host']) && !isset($node['port'])) { |
372 | 372 | return true; |
373 | 373 | } |
@@ -407,7 +407,7 @@ discard block |
||
407 | 407 | $rootNode |
408 | 408 | ->prototype('variable')->end() |
409 | 409 | ->validate() |
410 | - ->ifTrue(function ($node) { |
|
410 | + ->ifTrue(function($node) { |
|
411 | 411 | if (!is_array($node)) { |
412 | 412 | return true; |
413 | 413 | } |
@@ -484,7 +484,7 @@ discard block |
||
484 | 484 | ->append($this->addRabbitMqArgs()) |
485 | 485 | ->append($this->addRabbitMqExchange()) |
486 | 486 | ->end() |
487 | - ->validate()->always(function ($node) { |
|
487 | + ->validate()->always(function($node) { |
|
488 | 488 | if (empty($node['ssl_options'])) { |
489 | 489 | unset($node['ssl_options']); |
490 | 490 | } |
@@ -494,7 +494,7 @@ discard block |
||
494 | 494 | |
495 | 495 | return $node; |
496 | 496 | })->end() |
497 | - ->validate()->ifTrue(function ($node) { |
|
497 | + ->validate()->ifTrue(function($node) { |
|
498 | 498 | if (isset($node['ssl_options']) && !$node['ssl']) { |
499 | 499 | return true; |
500 | 500 | } |
@@ -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); |
@@ -60,13 +60,13 @@ |
||
60 | 60 | $methodName = $request->get('method'); |
61 | 61 | |
62 | 62 | $jobManager = $this->get('dtc_queue.manager.job'); |
63 | - $callback = function ($count) { |
|
63 | + $callback = function($count) { |
|
64 | 64 | echo json_encode(['count' => $count]); |
65 | 65 | echo "\n"; |
66 | 66 | flush(); |
67 | 67 | }; |
68 | 68 | |
69 | - $streamingResponse = new StreamedResponse(function () use ($jobManager, $callback, $workerName, $methodName) { |
|
69 | + $streamingResponse = new StreamedResponse(function() use ($jobManager, $callback, $workerName, $methodName) { |
|
70 | 70 | $total = $jobManager->countLiveJobs($workerName, $methodName); |
71 | 71 | echo json_encode(['total' => $total]); |
72 | 72 | echo "\n"; |