From 57873f1b7068979360db18c7c57d542d235d1a79 Mon Sep 17 00:00:00 2001 From: JKingsnorth Date: Tue, 12 Jan 2016 15:17:24 +0000 Subject: [PATCH] CRM-17629: Stop processing jobs if mailer batch limit reached --- CRM/Mailing/BAO/MailingJob.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/CRM/Mailing/BAO/MailingJob.php b/CRM/Mailing/BAO/MailingJob.php index 619bd8ccb8..21fd3c9d55 100644 --- a/CRM/Mailing/BAO/MailingJob.php +++ b/CRM/Mailing/BAO/MailingJob.php @@ -89,6 +89,7 @@ class CRM_Mailing_BAO_MailingJob extends CRM_Mailing_DAO_MailingJob { $config = CRM_Core_Config::singleton(); $jobTable = CRM_Mailing_DAO_MailingJob::getTableName(); $mailingTable = CRM_Mailing_DAO_Mailing::getTableName(); + $mailerBatchLimit = Civi::settings()->get('mailerBatchLimit'); if (!empty($testParams)) { $query = " @@ -215,6 +216,12 @@ class CRM_Mailing_BAO_MailingJob extends CRM_Mailing_DAO_MailingJob { if ($testParams) { return $isComplete; } + + // CRM-17629: Stop processing jobs if mailer batch limit reached + if ($mailerBatchLimit > 0 && self::$mailsProcessed >= $mailerBatchLimit) { + break; + } + } } -- 2.25.1