* Async service/Backup: updating job to next scheduled time BEFORE running it, to copy with jobs running longer then async frequency of 5min, eg. backup

This commit is contained in:
Ralf Becker 2013-07-25 13:11:07 +00:00
parent 59c683c359
commit 8e85c86f8b

View File

@ -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