Skip to content

Conversation

@arturaz
Copy link
Collaborator

@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
Collaborator 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
@arturaz
Copy link
Collaborator Author

arturaz commented Jan 2, 2025

Hi. Is there a reason why this does not get merged?

@yisraelU
Copy link
Collaborator

yisraelU commented Jan 7, 2025

@arturaz Hey , sorry I've been out a bit the past few weeks.
Would you mind creating a reproducer that I can take a look at ?
TY

@arturaz
Copy link
Collaborator Author

arturaz commented Jan 8, 2025

Would you mind creating a reproducer that I can take a look at ?

WDYM? I wrote a test that fails if the code change is not there.

@yisraelU yisraelU merged commit 641af86 into profunktor:series/1.x Jan 8, 2025
2 checks passed
@arturaz arturaz deleted the bug/subscribing-to-channel-and-pattern-doubles-messages-in-channel-subscriber branch January 9, 2025 19:48
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