Skip to content
Snippets Groups Projects
Commit d2f2b5ca authored by kartik1000's avatar kartik1000 Committed by mattwire
Browse files

check number of pending webhooks

parent 75bd4494
Branches
Tags
1 merge request!164Check number of pending webhooks to avoid connection limit
......@@ -262,8 +262,15 @@ class CRM_Core_Payment_StripeIPN {
->addValue('event_id', $this->eventID)
->execute();
if (!$processWebhook) {
return TRUE;
// Check the number of webhooks to be processed does not exceed connection-limit
$toBeProcessedWebhook = PaymentprocessorWebhook::get()
->setCheckPermissions(FALSE) // Replace with ::update(FALSE) when minversion = 5.29
->addWhere('payment_processor_id', '=', $this->_paymentProcessor->getID())
->addWhere('processed_date', 'IS NULL')
->execute();
if (!$processWebhook || $toBeProcessedWebhook->rowCount > 50 ) {
return TRUE;
}
return $this->processWebhook();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment