multifilesystem: Improve performance of PROPFIND

The PROPFIND does not need to check the filesystem for the file existence,
because the list comes from the directory listing, similar as the other
parts already do it. That was highly visible with large collections (10k+ items),
causing massive delays.

Also avoid repeated stat() calls on the same path.
This commit is contained in:
Milan Crha
2026-08-07 12:22:22 +02:00
parent 86fd5e8aa5
commit dc2a6ac1d7
5 changed files with 52 additions and 5 deletions

View File

@@ -50,7 +50,8 @@ class CollectionPartUpload(CollectionPartGet, CollectionPartCache,
(href, self.path, e)) from e
# store cache file
if self._storage._use_mtime_and_size_for_item_cache is True:
cache_hash = self._item_cache_mtime_and_size(os.stat(path).st_size, os.stat(path).st_mtime_ns)
path_stat = os.stat(path)
cache_hash = self._item_cache_mtime_and_size(path_stat.st_size, path_stat.st_mtime_ns)
if self._storage._debug_cache_actions is True:
logger.debug("Item cache store for: %r with mtime and size %r", path, cache_hash)
else:
@@ -121,7 +122,8 @@ class CollectionPartUpload(CollectionPartGet, CollectionPartCache,
# store cache file
if self._storage._use_mtime_and_size_for_item_cache is True:
cache_hash = self._item_cache_mtime_and_size(os.stat(path).st_size, os.stat(path).st_mtime_ns)
path_stat = os.stat(path)
cache_hash = self._item_cache_mtime_and_size(path_stat.st_size, path_stat.st_mtime_ns)
if self._storage._debug_cache_actions is True:
logger.debug("Item cache store for: %r with mtime and size %r", path, cache_hash)
else: