Write chat traces off the stream's thread

The OTel replay and the trace INSERT ran in the stream's finally, so a slow
database held the SSE connection open after the last event. The trace is
still frozen when the stream ends, but written on a small writer pool.
This commit is contained in:
arc53-machine committed 2026-09-23 22:42:05 +01:00
1 parent 0591580014
commit 778830208b
7 files changed
+91 -19

No files matched your search

+1 -1
View File
@@ -22,7 +22,7 @@ def _captured_flushes():
"""Record every flushed trace instead of writing it."""
flushed = []
def _fake_flush(trace, status=None):
def _fake_flush(trace, status=None, **_kwargs):
if trace is None or trace.flushed:
return
trace.flushed = True