Only unsubscribe from keyspace notifications if the node has the slot
This commit is contained in:
parent
d290aad27b
commit
bc02fe3831
|
@ -330,9 +330,12 @@ public class MessagesCache extends RedisClusterPubSubAdapter<String, String> imp
|
||||||
}
|
}
|
||||||
|
|
||||||
private void unsubscribeFromKeyspaceNotifications(final String queueName) {
|
private void unsubscribeFromKeyspaceNotifications(final String queueName) {
|
||||||
pubSubConnection.usePubSubConnection(connection -> connection.sync().upstream()
|
final int slot = SlotHash.getSlot(queueName);
|
||||||
.commands()
|
|
||||||
.unsubscribe(getKeyspaceChannels(queueName)));
|
pubSubConnection.usePubSubConnection(
|
||||||
|
connection -> connection.sync().nodes(node -> node.is(RedisClusterNode.NodeFlag.UPSTREAM) && node.hasSlot(slot))
|
||||||
|
.commands()
|
||||||
|
.unsubscribe(getKeyspaceChannels(queueName)));
|
||||||
}
|
}
|
||||||
|
|
||||||
private static String[] getKeyspaceChannels(final String queueName) {
|
private static String[] getKeyspaceChannels(final String queueName) {
|
||||||
|
|
Loading…
Reference in New Issue