- 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:
@@ -24,9 +24,7 @@ class Scheduler {
|
||||
}
|
||||
|
||||
function process() {
|
||||
$scheduled_queues = SendingQueue::where('status', 'scheduled')
|
||||
->whereLte('scheduled_at', Carbon::createFromTimestamp(current_time('timestamp')))
|
||||
->findMany();
|
||||
$scheduled_queues = self::getScheduledQueues();
|
||||
if(!count($scheduled_queues)) return;
|
||||
foreach($scheduled_queues as $i => $queue) {
|
||||
$newsletter = Newsletter::filter('filterWithOptions')
|
||||
@@ -185,4 +183,10 @@ class Scheduler {
|
||||
$notification_history :
|
||||
false;
|
||||
}
|
||||
|
||||
static function getScheduledQueues() {
|
||||
return SendingQueue::where('status', 'scheduled')
|
||||
->whereLte('scheduled_at', Carbon::createFromTimestamp(current_time('timestamp')))
|
||||
->findMany();
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user