- Rebases master
- Updates sending limit logic
This commit is contained in:
@@ -22,13 +22,14 @@ class SendingQueue {
|
|||||||
$this->mailer_task = new MailerTask();
|
$this->mailer_task = new MailerTask();
|
||||||
$this->newsletter_task = new NewsletterTask();
|
$this->newsletter_task = new NewsletterTask();
|
||||||
$this->timer = ($timer) ? $timer : microtime(true);
|
$this->timer = ($timer) ? $timer : microtime(true);
|
||||||
// abort if sending and/or execution limit are reached
|
// abort if sending limit is reached
|
||||||
$this->mailer_task->enforceSendingLimit();
|
|
||||||
CronHelper::enforceExecutionLimit($this->timer);
|
CronHelper::enforceExecutionLimit($this->timer);
|
||||||
}
|
}
|
||||||
|
|
||||||
function process() {
|
function process() {
|
||||||
foreach(self::getRunningQueues() as $queue) {
|
foreach(self::getRunningQueues() as $queue) {
|
||||||
|
// abort if sending limit is reached
|
||||||
|
$this->mailer_task->enforceSendingLimit();
|
||||||
// get and pre-process newsletter (render, replace shortcodes/links, etc.)
|
// get and pre-process newsletter (render, replace shortcodes/links, etc.)
|
||||||
$newsletter = $this->newsletter_task->getAndPreProcess($queue->asArray());
|
$newsletter = $this->newsletter_task->getAndPreProcess($queue->asArray());
|
||||||
if(!$newsletter) {
|
if(!$newsletter) {
|
||||||
@@ -158,10 +159,9 @@ class SendingQueue {
|
|||||||
StatisticsNewslettersModel::createMultiple($statistics);
|
StatisticsNewslettersModel::createMultiple($statistics);
|
||||||
// keep track of sent items
|
// keep track of sent items
|
||||||
$this->mailer_task->updateMailerLog();
|
$this->mailer_task->updateMailerLog();
|
||||||
$subscribers_to_process_count = count($queue->subscribers['to_process']);
|
|
||||||
$queue = $this->updateQueue($queue);
|
$queue = $this->updateQueue($queue);
|
||||||
// check sending limit if there are still subscribers left to send
|
// enforce sending limit if there are still subscribers left to process
|
||||||
if(isset($subscribers_to_process_count)) {
|
if($queue->count_to_process) {
|
||||||
$this->mailer_task->enforceSendingLimit();
|
$this->mailer_task->enforceSendingLimit();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user