From 42741fbe1edf98153d79f5b10c94edbc551bf7fe Mon Sep 17 00:00:00 2001 From: Ryan Breen Date: Tue, 3 Mar 2015 12:54:48 -0500 Subject: [PATCH] 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? --- TimberWinR/Outputs/Redis.cs | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/TimberWinR/Outputs/Redis.cs b/TimberWinR/Outputs/Redis.cs index 0e98118..eb8230b 100644 --- a/TimberWinR/Outputs/Redis.cs +++ b/TimberWinR/Outputs/Redis.cs @@ -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++; }