Skip to content

Commit

Permalink
Fix dead instance query by allowing lastSuccessfulDeliver is null (#1204
Browse files Browse the repository at this point in the history
)
  • Loading branch information
melroy89 authored Nov 4, 2024
1 parent 8180d0e commit 56b7d93
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src/Entity/Instance.php
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ public function getFailedDelivers(): int

public function isDead(): bool
{
return $this->getLastSuccessfulDeliver() < self::getDateBeforeDead() && $this->getFailedDelivers() >= self::NUMBER_OF_FAILED_DELIVERS_UNTIL_DEAD;
return ($this->getLastSuccessfulDeliver() < self::getDateBeforeDead() || null === $this->getLastSuccessfulDeliver())
&& $this->getFailedDelivers() >= self::NUMBER_OF_FAILED_DELIVERS_UNTIL_DEAD;
}
}
2 changes: 1 addition & 1 deletion src/Repository/InstanceRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ public function getDeadInstances(): array
{
return $this->createQueryBuilder('i')
->where('i.failedDelivers >= :numToDead')
->andWhere('i.lastSuccessfulDeliver < :dateBeforeDead')
->andWhere('i.lastSuccessfulDeliver < :dateBeforeDead OR i.lastSuccessfulDeliver IS NULL')
->setParameter('numToDead', Instance::NUMBER_OF_FAILED_DELIVERS_UNTIL_DEAD)
->setParameter('dateBeforeDead', Instance::getDateBeforeDead())
->orderBy('i.id')
Expand Down

0 comments on commit 56b7d93

Please sign in to comment.