Description:
I'm curious what is the relationship between RedisSentinelWorker and RedisPubSubServer.
From what I've observed the library holds at most 1 active sentinel connection even if there are more sentinel hosts available. That sentinel connection is wrapped in RedisSentinelWorker, which wraps RedisPubSubServer under the hood.
What bothers me is that RedisSentinelWorker and RedisPubSubServer might actually represent connections to two different sentinels.
Here is why this is happening:
var sentinel = new RedisSentinel(new[] {"localhost:26380", "localhost:26381", "localhost:26382"});
var manager = sentinel.Start();
By the time we reach ServiceStack.Redis.RedisSentinelWorker.BeginListeningForConfigurationChanges
the listening is supposed to start on sentinel localhost:26380. But when you reach ServiceStack.Redis.RedisPubSubServer.RunLoop
- an actual sentinel that we use to establish pub/sub connection to is actually localhost:26381.
This is happening because of the round robin mechanism underneath the ClientsManager
object we pass to RedisPubSubServer
. Before the pub/sub connection is established we actually call ClientsManager
twice.
- Inside of
ServiceStack.Redis.RedisPubSubServer.Init
to get server time. It returned localhost:26380. - Inside of
ServiceStack.Redis.RedisPubSubServer.RunLoop
to actually establish the subscription. It now returns localhost:26381.
So my question is: is how this works now intentional or this is a bug?