Reduce API startup storage prewarm
This commit is contained in:
@@ -105,8 +105,11 @@ class FileStorage:
|
||||
directory = self._collection_dir(collection)
|
||||
if not directory.exists():
|
||||
return []
|
||||
if limit is not None and limit <= 0:
|
||||
return []
|
||||
documents: list[dict[str, Any]] = []
|
||||
for path in sorted(directory.glob("*.json")):
|
||||
paths = directory.glob("*.json") if limit is not None else sorted(directory.glob("*.json"))
|
||||
for path in paths:
|
||||
try:
|
||||
documents.append(orjson.loads(path.read_bytes()))
|
||||
except (FileNotFoundError, orjson.JSONDecodeError):
|
||||
|
||||
Reference in New Issue
Block a user