Merge pull request #89 from oherrala/redisconn

Don't lose Redis connection on reconnect
This commit is contained in:
Mano Marks 2017-11-29 11:39:59 -08:00 committed by GitHub
commit 9652ca5e1c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -34,7 +34,8 @@ namespace Worker
// Reconnect redis if down // Reconnect redis if down
if (redisConn == null || !redisConn.IsConnected) { if (redisConn == null || !redisConn.IsConnected) {
Console.WriteLine("Reconnecting Redis"); Console.WriteLine("Reconnecting Redis");
redis = OpenRedisConnection("redis").GetDatabase(); redisConn = OpenRedisConnection("redis");
redis = redisConn.GetDatabase();
} }
string json = redis.ListLeftPopAsync("votes").Result; string json = redis.ListLeftPopAsync("votes").Result;
if (json != null) if (json != null)