Skip to content
This repository was archived by the owner on Dec 24, 2022. It is now read-only.

Commit d00755f

Browse files
committed
Add RedisSentinel.GetSentinelInfo()
1 parent 37fc0fc commit d00755f

File tree

2 files changed

+14
-3
lines changed

2 files changed

+14
-3
lines changed

src/ServiceStack.Redis/RedisSentinel.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,11 @@ public SentinelInfo FailoverToSentinelHosts()
160160
return GetValidSentinel().ConfigureRedisFromSentinel();
161161
}
162162

163+
public SentinelInfo GetSentinelInfo()
164+
{
165+
return GetValidSentinel().GetSentinelInfo();
166+
}
167+
163168
public void Dispose()
164169
{
165170
if (worker != null)

src/ServiceStack.Redis/RedisSentinelWorker.cs

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -82,9 +82,7 @@ private void SentinelMessageReceived(string channel, string message)
8282
/// </summary>
8383
internal SentinelInfo ConfigureRedisFromSentinel()
8484
{
85-
var sentinelInfo = new SentinelInfo(
86-
ConvertMasterArrayToList(this.sentinelClient.Sentinel("master", this.sentinelName)),
87-
ConvertSlaveArrayToList(this.sentinelClient.Sentinel("slaves", this.sentinelName)));
85+
var sentinelInfo = GetSentinelInfo();
8886

8987
if (redisManager == null)
9088
{
@@ -112,6 +110,14 @@ internal SentinelInfo ConfigureRedisFromSentinel()
112110
return sentinelInfo;
113111
}
114112

113+
internal SentinelInfo GetSentinelInfo()
114+
{
115+
var sentinelInfo = new SentinelInfo(
116+
ConvertMasterArrayToList(this.sentinelClient.Sentinel("master", this.sentinelName)),
117+
ConvertSlaveArrayToList(this.sentinelClient.Sentinel("slaves", this.sentinelName)));
118+
return sentinelInfo;
119+
}
120+
115121
private Dictionary<string, string> ParseDataArray(object[] items)
116122
{
117123
var data = new Dictionary<string, string>();

0 commit comments

Comments
 (0)