schedule next run before executing current run

This commit is contained in:
Uwe Steinmann 2021-08-17 20:54:57 +02:00
parent be7aa1b4a8
commit 73d27bc82b

View File

@ -84,10 +84,14 @@ foreach($tasks as $task) {
if(method_exists($taskobj, 'execute')) {
if(!$task->getDisabled() && $task->isDue()) {
if($mode == 'run') {
echo get_class($task);
/* Schedule the next run right away to prevent a second execution
* of the task when the cron job of the scheduler is called before
* the last run was finished. The task itself can still be scheduled
* to fast, but this is up to the admin of seeddms.
*/
$task->updateLastNextRun();
if($taskobj->execute($task)) {
add_log_line("Execution of task ".$task->getExtension()."::".$task->getTask()." successful.");
$task->updateLastNextRun();
} else {
add_log_line("Execution of task ".$task->getExtension()."::".$task->getTask()." failed, task has been disabled.", PEAR_LOG_ERR);
$task->setDisabled(1);