Merge pull request #9391 from nextcloud/getcachentry-lock-13

[13] remove unneeded locks in getCacheEntry
This commit is contained in:
Morris Jobke 2018-05-07 16:29:22 +02:00 committed by GitHub
commit 284b23333d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 3 deletions

View File

@ -1318,15 +1318,13 @@ class View {
try {
// if the file is not in the cache or needs to be updated, trigger the scanner and reload the data
if (!$data || $data['size'] === -1) {
$this->lockFile($relativePath, ILockingProvider::LOCK_SHARED);
if (!$storage->file_exists($internalPath)) {
$this->unlockFile($relativePath, ILockingProvider::LOCK_SHARED);
return false;
}
// don't need to get a lock here since the scanner does it's own locking
$scanner = $storage->getScanner($internalPath);
$scanner->scan($internalPath, Cache\Scanner::SCAN_SHALLOW);
$data = $cache->get($internalPath);
$this->unlockFile($relativePath, ILockingProvider::LOCK_SHARED);
} else if (!Cache\Scanner::isPartialFile($internalPath) && $watcher->needsUpdate($internalPath, $data)) {
$this->lockFile($relativePath, ILockingProvider::LOCK_SHARED);
$watcher->update($internalPath, $data);