Skip to content

Remove jitter during streaming#248

Merged
heyitsaamir merged 4 commits into
mainfrom
aamirj/fixStreaming
Jan 26, 2026
Merged

Remove jitter during streaming#248
heyitsaamir merged 4 commits into
mainfrom
aamirj/fixStreaming

Conversation

@heyitsaamir

Copy link
Copy Markdown
Collaborator

With jitter=full, sometimes we reduce our waits too too short (like if it was going to be 2s, it becomes like 0.5s). This leads to us eating through all our retries and getting a 429. Our service more aggressive than originally thought, so we need to keep jitter to none.

Copilot AI review requested due to automatic review settings January 25, 2026 23:27
Comment thread packages/apps/src/microsoft_teams/apps/http_stream.py
Removed unused import of HTTPStatusError from retry.py.
Comment thread packages/apps/tests/test_http_stream.py

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This pull request addresses retry jitter issues during streaming that were causing rate limit errors (429s). The changes remove jitter from retry logic and adjust retry parameters to prevent exhausting retries too quickly.

Changes:

  • Removed retry jitter (jitter_type="none") and adjusted retry parameters (max_attempts=8, max_delay=4.0) for streaming operations to prevent premature retry exhaustion
  • Improved notification mechanism by replacing polling with asyncio.Event for more efficient state change detection
  • Added special debug-level logging for expected 429 rate limit errors

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
packages/apps/src/microsoft_teams/apps/http_stream.py Updated retry options for _send_activity() to use no jitter, 8 attempts, and 4s max delay; replaced polling with Event-based state change notification
packages/apps/src/microsoft_teams/apps/utils/retry.py Added HTTPStatusError import and special handling to log 429 rate limit errors at debug level instead of error level
packages/apps/tests/test_http_stream.py Updated test assertion from 5 to 8 calls to match new max_attempts value

@heyitsaamir
heyitsaamir merged commit e91ab66 into main Jan 26, 2026
6 checks passed
@heyitsaamir
heyitsaamir deleted the aamirj/fixStreaming branch January 26, 2026 19:14
This was referenced Jan 27, 2026
heyitsaamir added a commit that referenced this pull request Jan 28, 2026
# Release version 2.0.0a9

Commits since v2.0.0a8:
  - Add support for Python 3.14 (#259)
  - Bump qs from 6.14.0 to 6.14.1 in /examples/tab/Web (#240)
  - Bump urllib3 from 2.5.0 to 2.6.3 (#251)
  - Bump authlib from 1.6.5 to 1.6.6 (#252)
  - Bump starlette from 0.48.0 to 0.49.1 (#261)
  - Bump fastmcp from 2.12.4 to 2.14.0 (#260)
  - Bump python-multipart from 0.0.20 to 0.0.22 (#254)
  - Bump virtualenv from 20.35.3 to 20.36.1 (#256)
  - Bump pyasn1 from 0.6.1 to 0.6.2 (#255)
  - Bump azure-core from 1.36.0 to 1.38.0 (#257)
  - Bump aiohttp from 3.13.0 to 3.13.3 (#258)
- fix meetingStart and meetingEnd casing bug & add meetings sample
(#246)
  - Remove jitter during streaming (#248)
  - Add SERVICE_URL to override default service_url for Teams (#247)
- [Fix] streaming: do not reset timeout for each emit, do not wait
forever on close stream (#197)
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.

3 participants