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') { ...@@ -492,12 +492,11 @@ function cron_lock($job, $start, $plugintype='core') {
$strstart = $started ? date('r', $started) : ''; $strstart = $started ? date('r', $started) : '';
$msg = "long-running cron job $jobname ($strstart)."; $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) { if ($started && $started < $start - 60*60*24) {
delete_records('config', 'field', $lockname); log_debug('Removing lock record for ' . $msg);
insert_record('config', (object) array('field' => $lockname, 'value' => $start)); cron_free($job, $started, $plugintype);
log_debug('Restarting ' . $msg); return false;
return true;
} }
log_debug('Skipping ' . $msg); 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