MDL-79130 task_adhoc: Defined max retry constant
This commit is contained in:
@@ -55,6 +55,11 @@ class manager {
|
||||
*/
|
||||
const ADHOC_TASK_FAILED_RETENTION = 4 * WEEKSECS;
|
||||
|
||||
/**
|
||||
* @var int Used for max retry.
|
||||
*/
|
||||
const MAX_RETRY = 9;
|
||||
|
||||
/**
|
||||
* @var array A cached queue of adhoc tasks
|
||||
*/
|
||||
@@ -236,7 +241,7 @@ class manager {
|
||||
}
|
||||
|
||||
// Check if the task is allowed to be retried or not.
|
||||
$record->attemptsavailable = $task->retry_until_success() ? null : 1;
|
||||
$record->attemptsavailable = $task->retry_until_success() ? self::MAX_RETRY : 1;
|
||||
|
||||
// Check if the same task is already scheduled.
|
||||
if ($checkforexisting && self::task_is_scheduled($task)) {
|
||||
@@ -1128,7 +1133,7 @@ class manager {
|
||||
$task->set_pid();
|
||||
$task->set_next_run_time(time() + $delay);
|
||||
$task->set_fail_delay($delay);
|
||||
if (!$task->retry_until_success() && $task->get_attempts_available() > 0) {
|
||||
if ($task->get_attempts_available() > 0) {
|
||||
$task->set_attempts_available($task->get_attempts_available() - 1);
|
||||
}
|
||||
$record = self::record_from_adhoc_task($task);
|
||||
|
||||
Reference in New Issue
Block a user