From: Seamus Lee Date: Tue, 20 Mar 2018 03:02:08 +0000 (+1100) Subject: Dev/Core 25 Wrap the mailing split_job function in a transaction to ensure that there... X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=2cf4876c0dc3a876b1d3054ebca11df853c9fd33;p=civicrm-core.git Dev/Core 25 Wrap the mailing split_job function in a transaction to ensure that there is no possibility of duplicate maiing jobs created Include the split_jobs in the transaction used to update the parent job --- diff --git a/CRM/Mailing/BAO/MailingJob.php b/CRM/Mailing/BAO/MailingJob.php index 0d49819d64..d86815a7a4 100644 --- a/CRM/Mailing/BAO/MailingJob.php +++ b/CRM/Mailing/BAO/MailingJob.php @@ -375,11 +375,11 @@ class CRM_Mailing_BAO_MailingJob extends CRM_Mailing_DAO_MailingJob { continue; } + $transaction = new CRM_Core_Transaction(); + $job->split_job($offset); // update the status of the parent job - $transaction = new CRM_Core_Transaction(); - $saveJob = new CRM_Mailing_DAO_MailingJob(); $saveJob->id = $job->id; $saveJob->start_date = date('YmdHis'); @@ -437,6 +437,7 @@ VALUES (%1, %2, %3, %4, %5, %6, %7) CRM_Core_DAO::executeQuery($sql, $params); } } + } /**