hiredis
hiredis copied to clipboard
UNSUBSCRIBE from a unsubscribed channel doesn't trigger callback
The current implementation doesn't keep a callback for UNSUBSCRIBE
command, the reason from the code base comments is that: every channel will receive an unsubscribe msg.
This design cause two problem:
- Callback passed with unsubscribe command never trigged.
- If the channel hasn't been subscribed, then we don't have a chance to handle related msg. As no callback for that channel yet.
Was this solved by #1012?
#1012 didn't change how the pubsub handling was done from start for RESP2, but it made sure unsubscribe in RESP3 works the same (no longer calling the registered push-callback).
It's correctly stated in bullet 1 that an unsubscribe response will call the subscribe-callback given when starting the subscription, i.e it's not using the callback given when sending the unsubscribe
message.
..and in bullet 2 that sending an unsubscribe
for a channel not subscribed to will not trigger any subscribe-callback, nor the given callback when sending the unsubscribe
. (Sending an unsubscribe
with no subscriptions at all will result in a REDIS_ERR)
I guess this would be a breaking change and probably needs some detailed reasons and benefits.