소스 검색

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)