diff --git a/phpgwapi/inc/class.asyncservice.inc.php b/phpgwapi/inc/class.asyncservice.inc.php index 759e2126c0..6c2b4ba8d8 100644 --- a/phpgwapi/inc/class.asyncservice.inc.php +++ b/phpgwapi/inc/class.asyncservice.inc.php @@ -433,6 +433,15 @@ class asyncservice { $job['data'] += array_diff_key($job,array('data' => false)); } + // update job before running it, to cope with jobs taking longer then async-frequency + if (($job['next'] = $this->next_run($job['times']))) + { + $this->write($job, True); + } + else // no further runs + { + $this->delete($job['id']); + } try { ExecMethod($job['method'],$job['data']); @@ -442,21 +451,6 @@ class asyncservice // log the exception to error_log, but continue running other async jobs _egw_log_exception($e); } - // re-read job, in case it had been updated or even deleted in the method - $updated = $this->read($id); - if ($updated && isset($updated[$id])) - { - $job = $updated[$id]; - - if ($job['next'] = $this->next_run($job['times'])) - { - $this->write($job,True); - } - else // no further runs - { - $this->delete($job['id']); - } - } } } $this->last_check_run(True,True,$run_by); // release semaphore