Skip to content

Commit 86bc9b4

Browse files
authored
Merge pull request #1025 from nextcloud/fix/lock-default-infinite
fix: do not expire locks when no timeout is configured
2 parents 7a27b9e + 72ef106 commit 86bc9b4

2 files changed

Lines changed: 4 additions & 6 deletions

File tree

lib/Service/ConfigService.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ class ConfigService {
1717
public const LOCK_TIMEOUT = 'lock_timeout';
1818

1919
public $defaults = [
20-
self::LOCK_TIMEOUT => '0'
20+
self::LOCK_TIMEOUT => '-1'
2121
];
2222

2323
/** @var string */

lib/Service/LockService.php

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -298,11 +298,9 @@ public function unlockFile(int $fileId, string $userId, bool $force = false, int
298298
*/
299299
public function getDeprecatedLocks(int $limit = 0): array {
300300
$timeout = (int)$this->configService->getAppValue(ConfigService::LOCK_TIMEOUT);
301-
if ($timeout === 0) {
302-
$this->logger->notice(
303-
'ConfigService::LOCK_TIMEOUT is not numerical, using default', ['current' => $timeout, 'exception' => new \Exception()]
304-
);
305-
$timeout = (int)$this->configService->defaults[ConfigService::LOCK_TIMEOUT];
301+
302+
if ($timeout === FileLock::ETA_INFINITE) {
303+
return [];
306304
}
307305

308306
try {

0 commit comments

Comments
 (0)