fix: use async thread in list files (#6754)

This commit is contained in:
Gabriel Luiz Freitas Almeida 2025-02-21 11:42:01 -03:00 committed by GitHub
commit 8c7eb57fd0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -88,7 +88,11 @@ class LocalStorageService(StorageService):
msg = f"Flow {flow_id} directory does not exist."
raise FileNotFoundError(msg)
files = [file.name async for file in anyio.Path(folder_path).iterdir() if await anyio.Path(file).is_file()]
files = [
file.name
async for file in await anyio.to_thread.run_sync(folder_path.iterdir)
if await anyio.Path(file).is_file()
]
logger.info(f"Listed {len(files)} files in flow {flow_id}.")
return files