DATAREDIS-1173 - Correctly unsubscribe from patterns/channels through LettuceSubscription.

doPUnsubscribe(…) and doUnsubscribe(…) now consider the all flag to unsubscribe from all subscribed patterns/channels. Previously, both methods didn't consider all and were invoked with an empty byte array which unsubscribed from an empty pattern/channel name and left subscriptions active.

Original Pull Request: #549
This commit is contained in:
Mark Paluch
2020-07-15 13:46:49 +02:00
committed by Christoph Strobl
parent 17b0fbcc63
commit e4fd036d81
2 changed files with 60 additions and 60 deletions

View File

@@ -95,8 +95,11 @@ public class LettuceSubscription extends AbstractSubscription {
*/
protected void doPUnsubscribe(boolean all, byte[]... patterns) {
// ignore `all` flag as Lettuce unsubscribes from all patterns if none provided.
pubsub.punsubscribe(patterns);
if (all) {
pubsub.punsubscribe();
} else {
pubsub.punsubscribe(patterns);
}
}
/*
@@ -113,8 +116,11 @@ public class LettuceSubscription extends AbstractSubscription {
*/
protected void doUnsubscribe(boolean all, byte[]... channels) {
// ignore `all` flag as Lettuce unsubscribes from all channels if none provided.
pubsub.unsubscribe(channels);
if (all) {
pubsub.unsubscribe();
} else {
pubsub.unsubscribe(channels);
}
}
}