[ 
https://issues.apache.org/jira/browse/GEODE-8627?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17217938#comment-17217938
 ] 

ASF GitHub Bot commented on GEODE-8627:
---------------------------------------

jdeppe-pivotal commented on a change in pull request #5639:
URL: https://github.com/apache/geode/pull/5639#discussion_r508840773



##########
File path: 
geode-redis/src/main/java/org/apache/geode/redis/internal/pubsub/PubSub.java
##########
@@ -81,19 +81,19 @@ long publish(
   long punsubscribe(GlobPattern pattern, Client client);
 
   /**
-   * Return a list of channel names that a client has subscribed to
+   * Return a list of channel names or patterns that a client has subscribed to
    *
    * @param client the Client which is to be queried
-   * @return the list of channels
+   * @return the list of channels or patterns
    */
-  List<byte[]> findSubscribedChannels(Client client);
+  List<byte[]> findSubscriptionsNames(Client client, Subscription.Type type);
 
   /**
-   * Return a list of pattern names that a client has subscribed to
+   * Return a list of channel names and patterns that a client has subscribed 
to
    *
    * @param client the Client which is to be queried
-   * @return the list of patterns
+   * @return the list of channels and patterns
    */
-  List<byte[]> findSubscribedPatterns(Client client);
+  List<byte[]> findSubscriptionsNames(Client client);;

Review comment:
       Only if you need to push another change: I think this should be 
`findSubscriptionNames` and the double `;` at the end of the line. No biggy.

##########
File path: 
geode-redis/src/main/java/org/apache/geode/redis/internal/pubsub/PubSubImpl.java
##########
@@ -140,18 +139,17 @@ public long punsubscribe(GlobPattern pattern, Client 
client) {
   }
 
   @Override
-  public List<byte[]> findSubscribedChannels(Client client) {
+  public List<byte[]> findSubscriptionsNames(Client client) {
     return subscriptions.findSubscriptions(client).stream()
-        .map(Subscription::getChannelName)
-        .filter(Objects::nonNull)
+        .map(Subscription::getSubscriptionName)
         .collect(Collectors.toList());
   }
 
   @Override
-  public List<byte[]> findSubscribedPatterns(Client client) {
+  public List<byte[]> findSubscriptionsNames(Client client, Subscription.Type 
type) {
     return subscriptions.findSubscriptions(client).stream()
-        .map(Subscription::getPatternName)
-        .filter(Objects::nonNull)
+        .filter(s -> s.getType().equals(type))

Review comment:
       Also no biggy, but for enum equality it's slightly better to use `==` 
since it's also null safe.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


> Redis not unsubscribing and punsubscribing correctly when no channel/pattern 
> provided
> -------------------------------------------------------------------------------------
>
>                 Key: GEODE-8627
>                 URL: https://issues.apache.org/jira/browse/GEODE-8627
>             Project: Geode
>          Issue Type: Bug
>          Components: redis
>            Reporter: Sarah Abbey
>            Assignee: Sarah Abbey
>            Priority: Major
>              Labels: pull-request-available
>
> Geode Redis should unsubscribe from all channels (not including patterns) 
> when no channel is provided and punsubscribe from all patterns (not including 
> channels) when no pattern is provided.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to