You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
The text was updated successfully, but these errors were encountered:
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 totrue
during the first subscriber invocation, thus preventing the creation of multiple threads during subsequent subscriber invocations.The text was updated successfully, but these errors were encountered: