Skip to content

refactor(brokers): re-design API to make groups a constructor option #10297

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

Merged
merged 11 commits into from
Jun 2, 2024

Conversation

nizans
Copy link
Contributor

@nizans nizans commented May 23, 2024

Please describe the changes this PR makes and why it should be merged:
A small fix A complete refactor to address the issue described in #10273 where the broker keeps pooling even when there's no subscribed events causing a Redis ReplyError.

This PR fixes this by stop pooling when there's no subscriptions and adds a cleanup to the event emitter listeners on the destroy as discussed in #10273

Please move lines that apply to you out of the comment:

  • Code changes have been tested against the Discord API, or there are no code changes
  • I know how to update typings and have done so, or typings don't need updating
  • This PR changes the library's interface (methods or parameters added)
  • This PR includes breaking changes (methods removed or renamed, parameters moved or removed)

@nizans nizans requested a review from a team as a code owner May 23, 2024 20:49
@nizans nizans requested review from iCrawl and didinele May 23, 2024 20:49
Copy link

vercel bot commented May 23, 2024

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

2 Ignored Deployments
Name Status Preview Comments Updated (UTC)
discord-js ⬜️ Ignored (Inspect) Visit Preview Jun 2, 2024 0:30am
discord-js-guide ⬜️ Ignored (Inspect) Visit Preview Jun 2, 2024 0:30am

@nizans nizans changed the title fix(BaseRedis): Stop pooling when no subscriptions and fix destroy fix(BaseRedis): Prevent pooling when no subscriptions and fix destroy May 23, 2024
@Jiralite Jiralite added this to the brokers 0.4.0 milestone May 23, 2024
Copy link

codecov bot commented May 23, 2024

Codecov Report

Attention: Patch coverage is 64.28571% with 10 lines in your changes are missing coverage. Please review.

Project coverage is 64.36%. Comparing base (29a50bb) to head (3439af9).

Files Patch % Lines
packages/brokers/src/brokers/redis/BaseRedis.ts 61.90% 8 Missing ⚠️
packages/brokers/src/brokers/redis/RPCRedis.ts 33.33% 2 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##             main   #10297       +/-   ##
===========================================
- Coverage   95.89%   64.36%   -31.54%     
===========================================
  Files          44        4       -40     
  Lines        3634      463     -3171     
  Branches      111        5      -106     
===========================================
- Hits         3485      298     -3187     
- Misses        149      165       +16     
Flag Coverage Δ
brokers 64.36% <64.28%> (-31.54%) ⬇️
builders 64.36% <64.28%> (-31.54%) ⬇️
collection 64.36% <64.28%> (-31.54%) ⬇️
discord.js 64.36% <64.28%> (-31.54%) ⬇️
formatters 64.36% <64.28%> (-31.54%) ⬇️
guide 64.36% <64.28%> (-31.54%) ⬇️
next 64.36% <64.28%> (-31.54%) ⬇️
proxy 64.36% <64.28%> (-31.54%) ⬇️
rest 64.36% <64.28%> (-31.54%) ⬇️
util 64.36% <64.28%> (-31.54%) ⬇️
utilities 64.36% <64.28%> (-31.54%) ⬇️
voice 64.36% <64.28%> (-31.54%) ⬇️
website 64.36% <64.28%> (-31.54%) ⬇️
ws 64.36% <64.28%> (-31.54%) ⬇️

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.

Copy link
Member

@didinele didinele left a comment

Choose a reason for hiding this comment

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

Thanks for this PR! I haven't had the time.

Removed `removeAllListeners` from destroy
@Jiralite Jiralite removed this from the brokers 0.4.0 milestone May 29, 2024
@Jiralite Jiralite added this to the brokers 0.4.0 milestone May 29, 2024
@didinele didinele changed the title fix(BaseRedis): Prevent pooling when no subscriptions and fix destroy refactor(brokers): re-design API to make groups a constructor option May 29, 2024
@kodiakhq kodiakhq bot merged commit 38a37b5 into discordjs:main Jun 2, 2024
22 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

Redis ReplyError when pulling with xreadgroup on empty subscribed events
5 participants