Use action scheduler's unique single action for daemon run

With the new unique parameter added in the action scheduler 3.5.0 the
as_schedule_single_action that schedules an immediate action
seems to be more convenient for the action scheduler.
We get better control over the scheduling of subsequent runs.
Note: We don't want to use the async action that is also executed immediately,
but it has the highest priority and we don't want to block actions scheduled by other plugins.
[MAILPOET-4684]
This commit is contained in:
Rostislav Wolny
2022-09-28 15:25:46 +02:00
committed by Aschepikov
parent e33539c5ca
commit a03f8f1c30
6 changed files with 24 additions and 6 deletions

View File

@@ -41,7 +41,7 @@ class DaemonRunTest extends \MailPoetTest {
$this->daemonRun->init();
expect($this->daemonRun->getDaemonExecutionLimit())->equals(20); // Verify initial execution limit
$this->actionScheduler->scheduleRecurringAction(time() - 1, 100, DaemonRun::NAME);
$this->actionScheduler->scheduleImmediateSingleAction(DaemonRun::NAME);
$actions = $this->actionSchedulerHelper->getMailPoetScheduledActions();
expect($actions)->count(1);
$doneActions = $this->actionSchedulerHelper->getMailPoetCompleteActions();