From: Donald A. Lobo Date: Thu, 18 Apr 2013 03:34:43 +0000 (-0700) Subject: CRM-12376 X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=df7f4ae1b31ebd503edace76b70f2c0b0c719f3f;p=civicrm-core.git CRM-12376 ---------------------------------------- * CRM-12376: CiviMail job with no remaining deliveries gets stuck in Running http://issues.civicrm.org/jira/browse/CRM-12376 --- 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)) {