diff options
Diffstat (limited to 'lib/Service/QueueService.php')
-rw-r--r-- | lib/Service/QueueService.php | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/lib/Service/QueueService.php b/lib/Service/QueueService.php index 6fc3b8f3..36cc46dd 100644 --- a/lib/Service/QueueService.php +++ b/lib/Service/QueueService.php @@ -147,6 +147,22 @@ class QueueService { } + public function getRequestStandby(int &$total = 0): array { + $requests = $this->requestQueueRequest->getStandby(); + $total = sizeof($requests); + + $result = []; + foreach ($requests as $request) { + $delay = floor(pow($request->getTries(), 4) / 3); + if ($request->getLast() < (time() - $delay)) { + $result[] = $request; + } + } + + return $result; + } + + /** * @param string $token * @param int $status @@ -186,6 +202,12 @@ class QueueService { } } + /** + * @param RequestQueue $queue + */ + public function deleteRequest(RequestQueue $queue) { + $this->requestQueueRequest->delete($queue); + } } |