mirror of
https://github.com/MODSetter/SurfSense.git
synced 2026-07-22 23:31:12 +02:00
TTS responses were written synchronously from the async presentation pipeline, blocking concurrent requests. Offload byte writes to a worker thread and add a regression test that keeps the event loop responsive.
7 lines
216 B
Python
7 lines
216 B
Python
import asyncio
|
|
from pathlib import Path
|
|
|
|
|
|
async def write_bytes(path: str, content: bytes) -> None:
|
|
"""Write bytes without blocking the event loop."""
|
|
await asyncio.to_thread(Path(path).write_bytes, content)
|