This repository was archived by the owner on Dec 24, 2022. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +12
-4
lines changed Expand file tree Collapse file tree 1 file changed +12
-4
lines changed Original file line number Diff line number Diff line change @@ -42,10 +42,15 @@ public class RedisSentinel : IRedisSentinel
42
42
public Func < string [ ] , string [ ] , IRedisClientsManager > RedisManagerFactory { get ; set ; }
43
43
44
44
/// <summary>
45
- /// Configure the Redis Connection String to use for a Redis Client Host
45
+ /// Configure the Redis Connection String to use for a Redis Instance Host
46
46
/// </summary>
47
47
public Func < string , string > HostFilter { get ; set ; }
48
48
49
+ /// <summary>
50
+ /// Configure the Redis Connection String to use for a Redis Sentinel Host
51
+ /// </summary>
52
+ public Func < string , string > SentinelHostFilter { get ; set ; }
53
+
49
54
/// <summary>
50
55
/// The configured Redis Client Manager this Sentinel managers
51
56
/// </summary>
@@ -185,15 +190,18 @@ public List<string> GetActiveSentinelHosts(IEnumerable<string> sentinelHosts)
185
190
var endpoint = sentinelHost . ToRedisEndpoint ( defaultPort : RedisConfig . DefaultPortSentinel ) ;
186
191
using ( var sentinelWorker = new RedisSentinelWorker ( this , endpoint ) )
187
192
{
188
- var activeHosts = sentinelWorker . GetSentinelHosts ( MasterName ) ;
189
-
190
193
if ( ! activeSentinelHosts . Contains ( sentinelHost ) )
191
194
activeSentinelHosts . Add ( sentinelHost ) ;
192
195
196
+ var activeHosts = sentinelWorker . GetSentinelHosts ( MasterName ) ;
193
197
foreach ( var activeHost in activeHosts )
194
198
{
195
199
if ( ! activeSentinelHosts . Contains ( activeHost ) )
196
- activeSentinelHosts . Add ( activeHost ) ;
200
+ {
201
+ activeSentinelHosts . Add ( SentinelHostFilter != null
202
+ ? SentinelHostFilter ( activeHost )
203
+ : activeHost ) ;
204
+ }
197
205
}
198
206
}
199
207
You can’t perform that action at this time.
0 commit comments