Skip to content

refactor!: make RedisBroker require consumer name #11001

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

didinele
Copy link
Member

In anticipation for TSR, I'm cooking some brokers stuff up again for the future.

While working on the Redis brokers, I realized that it's non-sense to default name, it was a wrong assumption I came with from RabbitMQ.

To spare some docs reading, a Redis consumer group (what we use under the hood) is used when you want to have multiple clients that see a sub set of the messages (evidently what we want with our brokers). The name here (or consumer name) identifies each one. If a client were to crash and restart automatically, with the user not providing the name argument, Redis ends up potentially leaving some messages in purgatory that were already assigned to the old name.

There's some more resilience I've noted we can add (like checking if there's messages in purgatory caused by a service downscale), but considering those tasks are relatively complex (low LOC diffs, but can have deep impact), I'm gonna split my PRs.

I've also used this one to update the outdated README examples.

Copy link

vercel bot commented Jul 18, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

2 Skipped Deployments
Name Status Preview Comments Updated (UTC)
discord-js ⬜️ Ignored (Inspect) Jul 18, 2025 3:48pm
discord-js-guide ⬜️ Ignored (Inspect) Visit Preview Jul 18, 2025 3:48pm

Copy link

codecov bot commented Jul 18, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 44.42%. Comparing base (aee6d31) to head (7214188).
Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #11001      +/-   ##
==========================================
- Coverage   44.42%   44.42%   -0.01%     
==========================================
  Files         308      308              
  Lines       17585    17583       -2     
  Branches     1749     1749              
==========================================
- Hits         7813     7811       -2     
  Misses       9759     9759              
  Partials       13       13              
Flag Coverage Δ
brokers 30.68% <100.00%> (-0.73%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@didinele didinele changed the title refactor!(RedisBroker): require consumer name refactor!: make RedisBroker require consumer name Jul 18, 2025
Co-authored-by: Noel <[email protected]>
maxChunk: 10,
blockTimeout: 5_000,
} as const satisfies Required<Omit<RedisBrokerOptions, 'group'>>;
} as const satisfies Required<Omit<RedisBrokerOptions, 'group' | 'name'>>;
Copy link
Member

Choose a reason for hiding this comment

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

From a docs perspective it would be better to have name and group be in their own interface and have the options interfaces extend both interfaces and have another interface only extending the one contained in these defaults. Omit is always bad for docs. Apart from that this LGTM

@Jiralite Jiralite added this to the brokers 2.0.0 milestone Jul 19, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Todo
Development

Successfully merging this pull request may close these issues.

4 participants