浏览代码

Don't lose Redis connection on reconnect

Keep Redis connection stored so that it's not lost and we avoid
reconnecting all the time.
Ossi Herrala 7 年之前
父节点
当前提交
c2eeb7ab73
共有 1 个文件被更改,包括 2 次插入1 次删除
  1. 2 1
      worker/src/Worker/Program.cs

+ 2 - 1
worker/src/Worker/Program.cs

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