Commit c02de1f4 authored by Andrew Robert Nicols's avatar Andrew Robert Nicols Committed by Gerrit Code Review
Browse files

Merge "Fix race condition in cron (bug #891170)"

parents 3e9e65ac 93639aac
......@@ -492,12 +492,11 @@ function cron_lock($job, $start, $plugintype='core') {
$strstart = $started ? date('r', $started) : '';
$msg = "long-running cron job $jobname ($strstart).";
// If it's been going for more than 24 hours, start another one anyway
// If it's been going for more than 24 hours, remove the lock
if ($started && $started < $start - 60*60*24) {
delete_records('config', 'field', $lockname);
insert_record('config', (object) array('field' => $lockname, 'value' => $start));
log_debug('Restarting ' . $msg);
return true;
log_debug('Removing lock record for ' . $msg);
cron_free($job, $started, $plugintype);
return false;
}
log_debug('Skipping ' . $msg);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment