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

Commit 81c8a4f

Browse files
committed
Handle errors trying to resolve master host from sentinel worker
1 parent 3bc6dbf commit 81c8a4f

File tree

1 file changed

+14
-4
lines changed

1 file changed

+14
-4
lines changed

src/ServiceStack.Redis/RedisSentinelWorker.cs

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -76,10 +76,20 @@ internal SentinelInfo GetSentinelInfo()
7676

7777
internal string GetMasterHost(string masterName)
7878
{
79-
var masterInfo = sentinelClient.SentinelGetMasterAddrByName(masterName);
80-
return masterInfo.Count > 0
81-
? SanitizeMasterConfig(masterInfo)
82-
: null;
79+
try
80+
{
81+
var masterInfo = sentinelClient.SentinelGetMasterAddrByName(masterName);
82+
return masterInfo.Count > 0
83+
? SanitizeMasterConfig(masterInfo)
84+
: null;
85+
}
86+
catch (Exception ex)
87+
{
88+
if (OnSentinelError != null)
89+
OnSentinelError(ex);
90+
91+
return null;
92+
}
8393
}
8494

8595
private string SanitizeMasterConfig(List<string> masterInfo)

0 commit comments

Comments
 (0)