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

[REFACTOR] spawn one subscriber thread for handling all the published messages to different channel #5063

Closed
Chethan-rao opened this issue Jun 20, 2024 · 0 comments · Fixed by #5064
Assignees
Labels
C-refactor Category: Refactor

Comments

@Chethan-rao
Copy link
Contributor

In the current Redis pub-sub implementation, a subscriber spawns a thread to handle all messages published to a channel. As a result, if a subscriber is invoked multiple times (even for subscribing to the same channel), it creates multiple threads for handling messages, which is not the desired behaviour. Ideally, we want to have only one subscriber thread handling all messages published to different channels. To achieve this, we maintain an atomic boolean variable, initially set to false, indicating whether the subscriber handler thread has been spawned. This variable will be set to true during the first subscriber invocation, thus preventing the creation of multiple threads during subsequent subscriber invocations.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-refactor Category: Refactor
Projects
None yet
1 participant