Good news, I have figured out why the keys aren’t being cleaned up.
If you have set:
NotifyChannelOfSubscriptions = false
then the keys will not be cleaned up in Redis but when using MemoryEvents it works without issues.
Is this to be expected?
I do not want/need every client on the channel to be notified when a client subscribes or unsubscribes.
Currently I only want to notify certain clients when a client subscribes or unsubscribes which I am currently doing manually. hence me switching NotifyChannelOfSubscriptions to false.
I took your configuration and found the root cause of the problem. In the Redis implementation the relied on the OnNotifyLeave event to clear the Redis key for the subscription.
These changes are included in the latest v5.13.1+ that’s now available on MyGet .
If you could please give these changes a try and let us know how it performs. I think it should help your performance however the approach of using GetAllSubscriptionInfos might still be too inefficient depending on your application throughput requirements.