Optimize newsletter reactivation
When reactivating a newsletter with many queues (e.g., a welcome email with a long history)
NewsletterEntity::getQueues may fail because it attempts to fetch all queues and instantiate
many entity objects.
In this commit, I optimize this by looking only into unfinished queues.
getUnfinishedQueues look for where countToProcess is higher than 0.
We set the count for welcome emails when we create a new queue
see f1ffc77bf3/mailpoet/lib/Newsletter/Scheduler/WelcomeScheduler.php (L140)
[MAILPOET-6310]
This commit is contained in:
committed by
Aschepikov
parent
1c3ea9cd0a
commit
3fbff8c83f
@@ -215,7 +215,7 @@ class Newsletters extends APIEndpoint {
|
||||
|
||||
// if there are paused tasks unpause them
|
||||
if ($newsletter->getStatus() === NewsletterEntity::STATUS_ACTIVE) {
|
||||
$queues = $newsletter->getQueues();
|
||||
$queues = $newsletter->getUnfinishedQueues();
|
||||
foreach ($queues as $queue) {
|
||||
$task = $queue->getTask();
|
||||
if ($task && $task->getStatus() === ScheduledTaskEntity::STATUS_PAUSED) {
|
||||
|
Reference in New Issue
Block a user