Skip to content
This repository has been archived by the owner on Jun 2, 2023. It is now read-only.

Commit

Permalink
SCENTRE-6184 Republish queue in initial status
Browse files Browse the repository at this point in the history
  • Loading branch information
stanislav.kovin authored and Tekill committed Mar 26, 2020
1 parent 047bd4b commit 0aa5dfc
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/Entity/QueueRepository.php
Expand Up @@ -73,17 +73,27 @@ public function getToRepublish(int $limit, ?int $offset = null): array
->where(
$qb->expr()->andX(
$qb->expr()->in('queue.status', ':statuses'),
$qb->expr()->eq('queue.isDeleted', ':not_deleted'),
$qb->expr()->lte('queue.scheduledAt', ':now')
)
)
->orWhere(
$qb->expr()->andX(
$qb->expr()->eq('queue.status', ':initial_status'),
$qb->expr()->lte('queue.createdAt', ':from_created_at')
)
)
->andWhere(
$qb->expr()->eq('queue.isDeleted', ':not_deleted')
)
->setParameters(
[
'statuses' => [
QueueEntityMappedSuperclass::STATUS_WAITING,
QueueEntityMappedSuperclass::STATUS_SCHEDULED,
],
'now' => new DateTime(),
'initial_status' => QueueEntityMappedSuperclass::STATUS_INITIAL,
'from_created_at' => (new DateTime())->modify('-5 minute'),
]
)
->setParameter('not_deleted', false, PDO::PARAM_BOOL)
Expand Down

0 comments on commit 0aa5dfc

Please sign in to comment.