Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

fix: use async thread in list files #6754

Merged
merged 1 commit into from
Feb 21, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion src/backend/base/langflow/services/storage/local.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,11 @@ async def list_files(self, flow_id: str):
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
Expand Down
Loading