From cdedda99e4b7f66f136d7db4788c2f033df2d442 Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Thu, 24 Mar 2016 14:07:43 +0100 Subject: Make lock ttl configurable --- lib/private/Server.php | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'lib/private/Server.php') diff --git a/lib/private/Server.php b/lib/private/Server.php index 581a2b44cea..2ce895c6f72 100644 --- a/lib/private/Server.php +++ b/lib/private/Server.php @@ -519,14 +519,17 @@ class Server extends ServerContainer implements IServerContainer { ); }); $this->registerService('LockingProvider', function (Server $c) { - if ($c->getConfig()->getSystemValue('filelocking.enabled', true) or (defined('PHPUNIT_RUN') && PHPUNIT_RUN)) { + $ini = $c->getIniWrapper(); + $config = $c->getConfig(); + $ttl = $config->getSystemValue('filelocking.ttl', max(3600, $ini->getNumeric('max_execution_time'))); + if ($config->getSystemValue('filelocking.enabled', true) or (defined('PHPUNIT_RUN') && PHPUNIT_RUN)) { /** @var \OC\Memcache\Factory $memcacheFactory */ $memcacheFactory = $c->getMemCacheFactory(); $memcache = $memcacheFactory->createLocking('lock'); if (!($memcache instanceof \OC\Memcache\NullCache)) { - return new MemcacheLockingProvider($memcache); + return new MemcacheLockingProvider($memcache, $ttl); } - return new DBLockingProvider($c->getDatabaseConnection(), $c->getLogger(), new TimeFactory()); + return new DBLockingProvider($c->getDatabaseConnection(), $c->getLogger(), new TimeFactory(), $ttl); } return new NoopLockingProvider(); }); -- cgit v1.2.3