Skip to content

fix(taskiq): cap RedisStreamBroker maxlen at 10k entries - #40

Merged
miragecentury merged 1 commit into
mainfrom
fix/taskiq-stream-maxlen
Aug 22, 2026
Merged

fix(taskiq): cap RedisStreamBroker maxlen at 10k entries#40
miragecentury merged 1 commit into
mainfrom
fix/taskiq-stream-maxlen

Conversation

@miragecentury

Copy link
Copy Markdown
Contributor

Summary

  • Pass maxlen=10_000 and approximate=True to RedisStreamBroker in SchedulerComponent.configure().
  • Expose optional stream_maxlen on TaskiqPlugin (default 10_000).

Test plan

  • pytest tests/units/.../test_schedulers.py
  • Tag v6.5.2 after merge to publish to PyPI

Made with Cursor

Prevents unbounded Taskiq stream growth that saturated prd Valkey at
1.50G (review stream alone held 6M entries). Trims on each XADD via
taskiq-redis approximate maxlen.

Co-authored-by: Cursor <cursoragent@cursor.com>
Copilot AI lite review requested due to automatic review settings August 22, 2026 11:54

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

Updates the Taskiq Redis stream broker configuration to cap stream growth by passing a bounded maxlen (default 10,000) and enabling approximate trimming, and exposes this as a configurable option on TaskiqPlugin.

Changes:

  • Add stream_maxlen (default 10_000) to SchedulerComponent.configure() and pass maxlen/approximate=True to RedisStreamBroker.
  • Add stream_maxlen (default 10_000) to TaskiqPlugin and forward it into the scheduler component configuration.
  • Add a unit test asserting the broker is constructed with maxlen/approximate, and document the fix in the changelog.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

File Description
tests/units/fastapi_factory_utilities/core/plugins/taskiq_plugin/test_schedulers.py Adds a unit test verifying stream_maxlen is forwarded into RedisStreamBroker(...).
src/fastapi_factory_utilities/core/plugins/taskiq_plugin/schedulers.py Adds stream_maxlen config and applies maxlen + approximate=True to the Redis stream broker.
src/fastapi_factory_utilities/core/plugins/taskiq_plugin/plugins.py Exposes stream_maxlen on TaskiqPlugin and wires it into scheduler configuration.
CHANGELOG.md Adds a 6.5.2 changelog entry describing the Redis stream trimming behavior change.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread CHANGELOG.md
Comment on lines +10 to +16
## [6.5.2] - 2026-08-22

### Fixed

- Taskiq: pass ``maxlen=10_000`` (approximate) to ``RedisStreamBroker`` so
Valkey Taskiq streams are trimmed on publish instead of growing without bound.

@miragecentury
miragecentury merged commit 261c4b1 into main Aug 22, 2026
9 checks passed
@miragecentury
miragecentury deleted the fix/taskiq-stream-maxlen branch August 22, 2026 12:11
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