- Adds new task scheduler configuration class
- Introduces method to start cron on demand when there are scheduled newsletters or queues in progress
This commit is contained in:
@ -27,7 +27,7 @@ class SendingQueue {
|
||||
|
||||
function process() {
|
||||
$this->mailer_task->checkSendingLimit();
|
||||
foreach($this->getQueues() as $queue) {
|
||||
foreach(self::getRunningQueues() as $queue) {
|
||||
// get and pre-process newsletter (render, replace shortcodes/links, etc.)
|
||||
$newsletter = $this->newsletter_task->getAndPreProcess($queue->asArray());
|
||||
if(!$newsletter) {
|
||||
@ -168,6 +168,13 @@ class SendingQueue {
|
||||
->findMany();
|
||||
}
|
||||
|
||||
static function getRunningQueues() {
|
||||
return SendingQueueModel::orderByDesc('priority')
|
||||
->whereNull('deleted_at')
|
||||
->whereNull('status')
|
||||
->findMany();
|
||||
}
|
||||
|
||||
function updateQueue($queue) {
|
||||
$queue->count_processed =
|
||||
count($queue->subscribers['processed']) + count($queue->subscribers['failed']);
|
||||
|
Reference in New Issue
Block a user