Skip to content

fix: ensure close handler is attached for Blob/ReadableStream cacheable responses#342

Merged
yusukebe merged 1 commit intov2from
perf-v2-close-handler-4
Apr 14, 2026
Merged

fix: ensure close handler is attached for Blob/ReadableStream cacheable responses#342
yusukebe merged 1 commit intov2from
perf-v2-close-handler-4

Conversation

@usualoma
Copy link
Copy Markdown
Member

The previous fast-path check (introduced in #333) (cacheKey in res) did not distinguish body types, allowing Blob and ReadableStream responses to skip close handler registration. This meant client disconnects during async body processing would not trigger AbortSignal.

Restrict the fast path to body types that complete synchronously (null, string, Uint8Array) via isImmediateCacheableResponse. All other cacheable responses now go through ensureCloseHandler for proper abort detection.

@usualoma
Copy link
Copy Markdown
Member Author

Hi @yusukebe
Would you mind reviewing this?

Copy link
Copy Markdown
Member

@yusukebe yusukebe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@yusukebe
Copy link
Copy Markdown
Member

@usualoma

Thanks! This should be fixed. Looks good.

@yusukebe yusukebe merged commit 25f1674 into v2 Apr 14, 2026
5 checks passed
@yusukebe yusukebe deleted the perf-v2-close-handler-4 branch April 14, 2026 09:05
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