Skip to content

[Fix] streaming: do not reset timeout for each chunk emit#378

Merged
MehakBindra merged 6 commits into
mainfrom
mehak/streaming
Dec 24, 2025
Merged

[Fix] streaming: do not reset timeout for each chunk emit#378
MehakBindra merged 6 commits into
mainfrom
mehak/streaming

Conversation

@MehakBindra

@MehakBindra MehakBindra commented Oct 16, 2025

Copy link
Copy Markdown
Member

Issue : #374

Main change::

  • In emit, instead of cancelling and scheduling a new timeout,
    - flush immediately if no timeout pending,
    - else push to queue and wait.
  • Added tests for streaming
Screen.Recording.2025-10-16.140937.mp4

Devtools: Streaming always starts before the full response is received (check with logs, see attached video).
Teams: Even though the first chunk is emitted immediately, (sometimes) by the time the stream starts on Teams, the full response is ready. In the second msg, we can see the stream starts a little bit before the full response is printed.

@MehakBindra MehakBindra changed the title [Fix] Do not reset timeout for each chunk emit [Fix] streaming: do not reset timeout for each chunk emit Oct 16, 2025
heyitsaamir
heyitsaamir previously approved these changes Oct 17, 2025

@heyitsaamir heyitsaamir left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Makes sense to me. Talked to Mehak offline about this too. @aacebo can you take a look too?

corinagum
corinagum previously approved these changes Oct 23, 2025
@aacebo

aacebo commented Oct 24, 2025

Copy link
Copy Markdown
Collaborator

@MehakBindra can you add some tests around this area?

Comment thread packages/apps/src/plugins/http/stream.ts
Comment thread packages/apps/src/utils/promises/retry.ts
Comment thread packages/apps/src/plugins/http/stream.spec.ts
@MehakBindra
MehakBindra merged commit e4d6bac into main Dec 24, 2025
9 checks passed
@MehakBindra
MehakBindra deleted the mehak/streaming branch December 24, 2025 22:01
@heyitsaamir heyitsaamir mentioned this pull request Mar 25, 2026
2 tasks
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.

5 participants