From df7f4ae1b31ebd503edace76b70f2c0b0c719f3f Mon Sep 17 00:00:00 2001 From: "Donald A. Lobo" Date: Wed, 17 Apr 2013 20:34:43 -0700 Subject: [PATCH] CRM-12376 ---------------------------------------- * CRM-12376: CiviMail job with no remaining deliveries gets stuck in Running http://issues.civicrm.org/jira/browse/CRM-12376 --- CRM/Mailing/BAO/Job.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/CRM/Mailing/BAO/Job.php b/CRM/Mailing/BAO/Job.php index 704484cedc..8c81602584 100644 --- a/CRM/Mailing/BAO/Job.php +++ b/CRM/Mailing/BAO/Job.php @@ -526,7 +526,10 @@ VALUES (%1, %2, %3, %4, %5, %6, %7) CRM_Core_Smarty::registerStringResource(); } - $isDelivered = FALSE; + // CRM-12376 + // This handles the edge case scenario where all the mails + // have been delivered in prior jobs + $isDelivered = TRUE; // make sure that there's no more than $config->mailerBatchLimit mails processed in a run while ($eq->fetch()) { @@ -534,7 +537,8 @@ VALUES (%1, %2, %3, %4, %5, %6, %7) // CRM_Utils_System::xMemory( "$mailsProcessed: " ); // } - if ($config->mailerBatchLimit > 0 && + if ( + $config->mailerBatchLimit > 0 && $mailsProcessed >= $config->mailerBatchLimit ) { if (!empty($fields)) { -- 2.25.1