diff options
author | Joas Schilling <nickvergessen@owncloud.com> | 2016-04-21 11:33:44 +0300 |
---|---|---|
committer | Joas Schilling <nickvergessen@owncloud.com> | 2016-04-22 10:56:18 +0300 |
commit | 9dc1c6c41f4f59ba23d2823973b9ea33178f3bf3 (patch) | |
tree | a16f16259936237b22eeed59f533e442478abd4d /cron.php | |
parent | 81b5df32365123d2c9b8a912f7ec47d1d3b29b5a (diff) |
Make sure that CLI cron doesn't run for ever, but makes use of the next spawn
Diffstat (limited to 'cron.php')
-rw-r--r-- | cron.php | 8 |
1 files changed, 8 insertions, 0 deletions
@@ -131,6 +131,10 @@ try { // Work $jobList = \OC::$server->getJobList(); + // We only ask for jobs for 14 minutes, because after 15 minutes the next + // system cron task should spawn. + $endTime = time() + 14 * 60; + $executedJobs = []; while ($job = $jobList->getNext()) { if (isset($executedJobs[$job->getId()])) { @@ -144,6 +148,10 @@ try { $jobList->setLastJob($job); $executedJobs[$job->getId()] = true; unset($job); + + if (time() > $endTime) { + break; + } } // unlock the file |