Skip to content

Blocking file I/O inside async function in video presentation node #1603

Description

@Joaquinriosheredia

Hi,

I've been running python-vibe-guard against open source Python projects
to validate async runtime detection rules.

Found a potential issue in:
surfsense_backend/app/agents/video_presentation/nodes.py line 140

response = await aspeech(**kwargs)
with open(chunk_path, "wb") as f:
    f.write(response.content)

open() and f.write() are synchronous calls inside an async function.
Under concurrent load, this blocks the event loop for the duration of
each file write, serializing all concurrent connections through a single
bottleneck.

Consider using aiofiles as an async alternative:

import aiofiles
async with aiofiles.open(chunk_path, "wb") as f:
    await f.write(response.content)

Tool used: python-vibe-guard
AST-based runtime anti-pattern scanner validated on 250 real repositories.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions