mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-12 20:43:25 +00:00
PHRAS-3598 Webhook - Emit improvement - Count and Log errors - stop to notify endpoint in error (#4209)
* deactivate webhook when many times undelivered * fix * fix log
This commit is contained in:
@@ -23,7 +23,6 @@ use Doctrine\ORM\EntityRepository;
|
||||
*/
|
||||
class WebhookEventDeliveryRepository extends EntityRepository
|
||||
{
|
||||
|
||||
/**
|
||||
* @return WebhookEventDelivery[]
|
||||
*/
|
||||
@@ -40,6 +39,26 @@ class WebhookEventDeliveryRepository extends EntityRepository
|
||||
return $qb->getQuery()->getResult();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $apiApplication
|
||||
* @return WebhookEventDelivery[]
|
||||
*/
|
||||
public function findUndeliveredEventsFromLastAppUpdate(ApiApplication $apiApplication)
|
||||
{
|
||||
$qb = $this->createQueryBuilder('e');
|
||||
|
||||
$qb
|
||||
->join('e.application', 'a')
|
||||
->where('e.application = :app')
|
||||
->andWhere($qb->expr()->eq('e.delivered', $qb->expr()->literal(false)))
|
||||
->andWhere('e.deliveryTries = 3')
|
||||
->andWhere('e.created > a.updated')
|
||||
->setParameter(':app', $apiApplication)
|
||||
;
|
||||
|
||||
return $qb->getQuery()->getResult();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param ApiApplication $apiApplication
|
||||
* @param int $count
|
||||
|
Reference in New Issue
Block a user