Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoas Schilling <nickvergessen@owncloud.com>2016-05-20 12:14:47 +0300
committerJoas Schilling <nickvergessen@owncloud.com>2016-05-21 02:59:25 +0300
commit92c21fd6f456d083af8fa64a713c9a0e8d59d1c1 (patch)
tree2e8bcaabea3e9671127880ccc0eda63ac81ae5a9 /cron.php
parentd0a2fa050694232554242c6344439915f3f09d12 (diff)
Do not lock the cron anymore so we can have multiple workers
Diffstat (limited to 'cron.php')
-rw-r--r--cron.php27
1 files changed, 0 insertions, 27 deletions
diff --git a/cron.php b/cron.php
index c8ce5e2b50a..d8ed3741f05 100644
--- a/cron.php
+++ b/cron.php
@@ -100,34 +100,11 @@ try {
}
}
- $instanceId = $config->getSystemValue('instanceid');
- $lockFileName = 'owncloud-server-' . $instanceId . '-cron.lock';
- $lockDirectory = $config->getSystemValue('cron.lockfile.location', sys_get_temp_dir());
- $lockDirectory = rtrim($lockDirectory, '\\/');
- $lockFile = $lockDirectory . '/' . $lockFileName;
-
- if (!file_exists($lockFile)) {
- touch($lockFile);
- }
-
// We call ownCloud from the CLI (aka cron)
if ($appMode != 'cron') {
\OCP\BackgroundJob::setExecutionType('cron');
}
- // open the file and try to lock it. If it is not locked, the background
- // job can be executed, otherwise another instance is already running
- $fp = fopen($lockFile, 'w');
- $isLocked = flock($fp, LOCK_EX|LOCK_NB, $wouldBlock);
-
- // check if backgroundjobs is still running. The wouldBlock check is
- // needed on systems with advisory locking, see
- // http://php.net/manual/en/function.flock.php#45464
- if (!$isLocked || $wouldBlock) {
- echo "Another instance of cron.php is still running!" . PHP_EOL;
- exit(1);
- }
-
// Work
$jobList = \OC::$server->getJobList();
@@ -155,10 +132,6 @@ try {
}
}
- // unlock the file
- flock($fp, LOCK_UN);
- fclose($fp);
-
} else {
// We call cron.php from some website
if ($appMode == 'cron') {