Files
piratepoet/mailpoet/tests/integration/Cron/ActionScheduler/ActionSchedulerTestHelper.php
Rostislav Wolny de22257af3 Do not schedule next action scheduler run after suspiciously short run
In case we still have work to do but the previous run ended too early and it still had some execution time left
we will not schedule new action.
This is prevention for creating a run action every one second in case there is e.g. some stuck job.
Next run will be triggered within the trigger action that runs every 2 minutes.
[MAILPOET-4684]
2022-10-13 14:21:43 +02:00

29 lines
796 B
PHP

<?php declare(strict_types=1);
namespace MailPoet\Cron\ActionScheduler;
class ActionSchedulerTestHelper {
public function getMailPoetScheduledActions(): array {
$actions = as_get_scheduled_actions([
'group' => ActionScheduler::GROUP_ID,
'status' => [\ActionScheduler_Store::STATUS_PENDING, \ActionScheduler_Store::STATUS_RUNNING],
]);
return $actions;
}
public function getMailPoetCompleteActions(): array {
$actions = as_get_scheduled_actions([
'group' => ActionScheduler::GROUP_ID,
'status' => [\ActionScheduler_Store::STATUS_COMPLETE],
]);
return $actions;
}
public function getMailPoetCronActions(): array {
$actions = as_get_scheduled_actions([
'group' => ActionScheduler::GROUP_ID,
]);
return $actions;
}
}