public static function scheduled_task_failed(scheduled_task $task) {
        global $DB;

        $delay = $task->get_fail_delay();

        // Reschedule task with exponential fall off for failing tasks.
        if (empty($delay)) {
            $delay = 60;
        } else {
            $delay *= 2;
        }

        // Max of 24 hour delay.
        if ($delay > 86400) {
            $delay = 86400;
        }

        $classname = self::get_canonical_class_name($task);

        $record = $DB->get_record('task_scheduled', array('classname' => $classname));
        $record->nextruntime = time() + $delay;
        $record->faildelay = $delay;
        $DB->update_record('task_scheduled', $record);

        if ($task->is_blocking()) {
            $task->get_cron_lock()->release();
        }
        $task->get_lock()->release();

        // Finalise the log output.
        logmanager::finalise_log(true);
    }
public static function scheduled_task_failed(scheduled_task $task) {
        global $DB;

        $delay = $task->get_fail_delay();

        // Reschedule task with exponential fall off for failing tasks.
        if (empty($delay)) {
            $delay = 60;
        } else {
            $delay *= 2;
        }

        // Max of 24 hour delay.
        if ($delay > 86400) {
            $delay = 86400;
        }

        $classname = self::get_canonical_class_name($task);

        $record = $DB->get_record('task_scheduled', array('classname' => $classname));
        $record->nextruntime = time() + $delay;
        $record->faildelay = $delay;
        $DB->update_record('task_scheduled', $record);

        if ($task->is_blocking()) {
            $task->get_cron_lock()->release();
        }
        $task->get_lock()->release();

        // Finalise the log output.
        logmanager::finalise_log(true);
    }
public static function scheduled_task_failed ( scheduled_task $ task ) { global $ DB ; $ delay = $ task -> get_fail_delay ( ) ; // Reschedule task with exponential fall off for failing tasks. if ( empty ( $ delay ) ) { $ delay = 60 ; } else { $ delay *= 2 ; } // Max of 24 hour delay. if ( $ delay > 86400 ) { $ delay = 86400 ; } $ classname = self :: get_canonical_class_name ( $ task ) ; $ record = $ DB -> get_record ( 'task_scheduled' , array ( 'classname' => $ classname ) ) ; $ record -> nextruntime = time ( ) + $ delay ; $ record -> faildelay = $ delay ; $ DB -> update_record ( 'task_scheduled' , $ record ) ; if ( $ task -> is_blocking ( ) ) { $ task -> get_cron_lock ( ) -> release ( ) ; } $ task -> get_lock ( ) -> release ( ) ; // Finalise the log output. logmanager :: finalise_log ( true ) ; }
This function indicates that a scheduled task was not completed successfully and should be retried.

@param \core\task\scheduled_task $task
This function indicates that a scheduled task was not completed successfully and should be retried .