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

Commit 319aaae

Browse files
committed
Bubble Exceptions from GetMasterHost() when called from GetSentinelInfo()
1 parent 731283f commit 319aaae

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

src/ServiceStack.Redis/RedisSentinelWorker.cs

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -66,9 +66,10 @@ private void SentinelMessageReceived(string channel, string message)
6666

6767
internal SentinelInfo GetSentinelInfo()
6868
{
69+
var masterHost = GetMasterHostInternal(sentinel.MasterName);
6970
var sentinelInfo = new SentinelInfo(
7071
sentinel.MasterName,
71-
new[] { GetMasterHost(sentinel.MasterName) },
72+
new[] { masterHost },
7273
GetSlaveHosts(sentinel.MasterName));
7374

7475
return sentinelInfo;
@@ -78,10 +79,7 @@ internal string GetMasterHost(string masterName)
7879
{
7980
try
8081
{
81-
var masterInfo = sentinelClient.SentinelGetMasterAddrByName(masterName);
82-
return masterInfo.Count > 0
83-
? SanitizeMasterConfig(masterInfo)
84-
: null;
82+
return GetMasterHostInternal(masterName);
8583
}
8684
catch (Exception ex)
8785
{
@@ -92,6 +90,14 @@ internal string GetMasterHost(string masterName)
9290
}
9391
}
9492

93+
private string GetMasterHostInternal(string masterName)
94+
{
95+
var masterInfo = sentinelClient.SentinelGetMasterAddrByName(masterName);
96+
return masterInfo.Count > 0
97+
? SanitizeMasterConfig(masterInfo)
98+
: null;
99+
}
100+
95101
private string SanitizeMasterConfig(List<string> masterInfo)
96102
{
97103
var ip = masterInfo[0];

0 commit comments

Comments
 (0)