Move redisHostIndex inc to a finally
It looks like this will just retry connections to the same host if new RedisClient throws. Move _redisHostIndex++ to a finally. Should we also be logging when these happen?
This commit is contained in:
@@ -60,16 +60,17 @@ namespace TimberWinR.Outputs
|
||||
try
|
||||
{
|
||||
RedisClient client = new RedisClient(_redisHosts[_redisHostIndex], _port, _timeout);
|
||||
|
||||
_redisHostIndex++;
|
||||
if (_redisHostIndex >= _redisHosts.Length)
|
||||
_redisHostIndex = 0;
|
||||
|
||||
return client;
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
}
|
||||
finally
|
||||
{
|
||||
_redisHostIndex++;
|
||||
if (_redisHostIndex >= _redisHosts.Length)
|
||||
_redisHostIndex = 0;
|
||||
}
|
||||
numTries++;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user