| Conditions | 2 |
| Paths | 2 |
| Total Lines | 21 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 12 |
| CRAP Score | 2 |
| Changes | 0 | ||
| 1 | <?php |
||
| 30 | 2 | public function delayQueue(QueueEntityInterface $queue): QueueEntityInterface |
|
| 31 | { |
||
| 32 | try { |
||
| 33 | 2 | $strategy = $this->strategyService->getStrategy($queue->getName()); |
|
| 34 | 1 | } catch (UnknownStrategyKeyException $exception) { |
|
| 35 | 1 | $this->logger->warning( |
|
| 36 | 1 | $exception->getMessage(), [ |
|
| 37 | 1 | 'queue_name' => $queue->getName(), |
|
| 38 | ] |
||
| 39 | ); |
||
| 40 | 1 | $strategy = $this->strategyService->getDefaultStrategy(); |
|
| 41 | } |
||
| 42 | |||
| 43 | 2 | $iteration = $queue->getAttempts() ?? 1; |
|
| 44 | 2 | $newDelayInterval = $strategy->generateInterval($iteration); |
|
| 45 | 2 | $delayUntil = $this->getStartDateTime()->add($newDelayInterval); |
|
| 46 | |||
| 47 | 2 | $queue->setWaiting($delayUntil); |
|
| 48 | |||
| 49 | 2 | return $queue; |
|
| 50 | } |
||
| 51 | |||
| 57 |