Skip to content

fix(listener): Limit retries to a maximum of three. - #267

Merged
yusukebe merged 2 commits into
honojs:mainfrom
usualoma:fix-retry-read
Aug 2, 2025
Merged

yusukebe merged 2 commits into
honojs:mainfrom
usualoma:fix-retry-read

Conversation

@usualoma

@usualoma usualoma commented Aug 2, 2025 •

Copy link
Copy Markdown
Member

fixes #266

If the application did not include Transfer-Encoding: chunked, depending on the timing of enqueue, it would loop indefinitely until the second chunk was read.

One way to do this is to treat text/event-stream as special, as @yusukebe pointed out in this comment, but I would prefer to resolve this without depending on a specific Content-Type.

#265 (comment)

Essentially, the problem was simply #265's i-- and currentReadPromise = reader.read(), so I think that fixing that should be sufficient without any additional logical changes.

Minimal reproducible example

https://github.com/usualoma/hono-se-266

@usualoma

usualoma commented Aug 2, 2025

Copy link
Copy Markdown
Member Author

@yusukebe
Would you please review this?

@yusukebe yusukebe left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM!

@yusukebe

yusukebe commented Aug 2, 2025

Copy link
Copy Markdown
Member

Hi @usualoma

I've tried some edge cases based on your repro. They work well! Looks good, thank you!

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.

v1.18.0 breaks Server-Sent Events (SSE) real-time streaming - first chunk delayed by pre-read logic

2 participants