Skip to content
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

ReliableTopic only deletes expired subscribers when a message is read #4765

Closed
faroukfaiz10 opened this issue Dec 28, 2022 · 2 comments
Closed
Labels
Milestone

Comments

@faroukfaiz10
Copy link

faroukfaiz10 commented Dec 28, 2022

Observation

ReliableTopics only remove expired subscribers and trim messages (i.e. those read by all subscribers) when a new message is published on the topic (i.e. when the blocking XREAD succeeds to read a message).

Problematic

This is problematic for Reliable topics that are not very active (i.e. do not have a lot of messages published), but have a lot of new subscribers. Over time, the subscribers list grows very large (of expired subscribers) because they’re only removed on new message reception, which doesn’t happen very often.

As a result, when a message gets published, it doesn't get deleted for a long time (months in my case), because a lot of the expired subscribers, that will never read that message, were not removed from the list.

Questions

  1. Why does the deletion of old subscribers (and the trimming of messages as a result) not happen in every poll (i.e. even if no message was read)? That way, ReliableTopics that do not get a lot of published messages will behave like those that get a lot of published messages => Both will not have expired subscribers left for long.

  2. Suppose I want expired subscribers to be deleted ASAP. Is there an easier way to achieve this than to manually do it myself (e.g. on a separate cron job)?

@mrniko
Copy link
Member

mrniko commented Dec 29, 2022

I found the cause. All expired subscribers weren't deleted at once per call, only a single one.

Below is the change

69b7110

@mrniko mrniko added bug and removed question labels Dec 29, 2022
@faroukfaiz10
Copy link
Author

Great! Thanks for your reactivity on this.

@mrniko mrniko closed this as completed Jan 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

No branches or pull requests

2 participants