Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug/subscribing to channel and pattern doubles messages in channel subscriber #950

Open
wants to merge 4 commits into
base: series/1.x
Choose a base branch
from

Conversation

arturaz
Copy link

@arturaz arturaz commented Dec 13, 2024

I have noticed that if you:

  • subscribe to a channel "foo:bar"
  • subscribe to a pattern "foo:*"

The messages sent to "foo:bar" will get delivered once to the "foo:*" stream and TWICE to the "foo:bar" stream.

This is a fix for that.

@yisraelU
Copy link
Collaborator

@arturaz does this occur with only one subscription to channel "foo:bar" ?
The method being changed is the decision to listen for patterns on a Channel Listener. According to your report, it would seem that all channel listeners (non patterned) would have both methods invoked when it receives a message .
This would seem to be a bug in Lettuce ?

@arturaz
Copy link
Author

arturaz commented Dec 18, 2024

does this occur with only one subscription to channel "foo:bar" ?

No.

According to your report, it would seem that all channel listeners (non patterned) would have both methods invoked when it receives a message .

def message(pattern: K, channel: K, message: V): Unit = this.message(channel, message) is invoked when you get a message that matches a pattern that you subscribed to.

def message(channel: K, message: V): Unit is invoked when you get a message to a channel that you subscribed to.

Lettuce just notifies all of the listeners with all events that it receives, it has no idea what's the intent of the listener.

If you subscribed to a channel and a pattern matching the same channel, both methods will get invoked in the channelListener. You have patternListener for patterns, why would channelListener listen to BOTH patterns and channels?

This would seem to be a bug in Lettuce ?

This seems like a bug in redis4cats to me.

…cribing-to-channel-and-pattern-doubles-messages-in-channel-subscriber
arturaz added a commit to arturaz/packages that referenced this pull request Dec 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants