Skip to content

fix-improving-tracking-of-aborted-streams#160

Merged
subpath merged 1 commit into
mainfrom
fix-improving-tracking-of-aborted-streams
May 29, 2026
Merged

fix-improving-tracking-of-aborted-streams#160
subpath merged 1 commit into
mainfrom
fix-improving-tracking-of-aborted-streams

Conversation

@subpath
Copy link
Copy Markdown
Collaborator

@subpath subpath commented May 29, 2026

When a user closes the app or cancels a stream mid-response, Starlette throws GeneratorExit (or cancels the task) into the streaming generator. We weren't catching that, so the result stayed at its initial error
value and got recorded as an error in the latency metric.

It's important because our disconnect detection relies on a poller that checks every 100ms. The teardown almost always happens before the poller fires, so most disconnects were slipping through and landing in the
error bucket.

I believe that this could be dragging down the s2s success rate.

@subpath subpath requested a review from a team as a code owner May 29, 2026 14:38
@subpath subpath merged commit e8215bb into main May 29, 2026
1 check passed
@subpath subpath deleted the fix-improving-tracking-of-aborted-streams branch May 29, 2026 14:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants