Skip to content

Detect pub sub subscription status/connection on the cluster client? #2725

@Nic0S

Description

@Nic0S

Motivation

My goal is to detect the state of a long running pubsub subscription in cluster mode. For example, if the client is disconnected from the cluster for some amount of time (let's say network issue, or restart of a Redis node), it would be useful to receive some event from the client, and to receive another event once the subscription is reestablished.

According to #1855,
the cluster client does not produce events on reconnection. How can the application monitor the current status of the subscription?

To explain more about my use case, we are using pubsub for cache invalidation across machines. If the subscription connection to Redis is lost for any reason, we need to invalidate the whole cache and stop inserting new values until we get the connection back.

Is this something that can be accomplished currently?

Another related question; what happens if a value is published while the client is reconnecting to Redis? Will the value be published upon reconnection, assuming the client eventually does reconnect?

Basic Code Example

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions