Ver Fonte

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 há 7 anos atrás
pai
commit
c2eeb7ab73
1 ficheiros alterados com 2 adições e 1 exclusões
  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)