Parcourir la source

Reword connection retry messages

Aanand Prasad il y a 9 ans
Parent
commit
036c119e2c
2 fichiers modifiés avec 7 ajouts et 4 suppressions
  1. 1 1
      result/server.js
  2. 6 3
      worker/src/Worker/Program.cs

+ 1 - 1
result/server.js

@@ -26,7 +26,7 @@ async.retry(
   function(callback) {
     pg.connect('postgres://postgres@db/postgres', function(err, client, done) {
       if (err) {
-        console.error("Failed to connect to db");
+        console.error("Waiting for db");
       }
       callback(err, client);
     });

+ 6 - 3
worker/src/Worker/Program.cs

@@ -52,16 +52,18 @@ namespace Worker
                 }
                 catch (SocketException)
                 {
-                    Console.Error.WriteLine("Failed to connect to db - retrying");
+                    Console.Error.WriteLine("Waiting for db");
                     Thread.Sleep(1000);
                 }
                 catch (DbException)
                 {
-                    Console.Error.WriteLine("Failed to connect to db - retrying");
+                    Console.Error.WriteLine("Waiting for db");
                     Thread.Sleep(1000);
                 }
             }
 
+            Console.Error.WriteLine("Connected to db");
+
             var command = connection.CreateCommand();
             command.CommandText = @"CREATE TABLE IF NOT EXISTS votes (
                                         id VARCHAR(255) NOT NULL UNIQUE, 
@@ -82,11 +84,12 @@ namespace Worker
             {
                 try
                 {
+                    Console.Error.WriteLine("Connected to redis");
                     return ConnectionMultiplexer.Connect(ipAddress);
                 }
                 catch (RedisConnectionException)
                 {
-                    Console.Error.WriteLine("Failed to connect to redis - retrying");
+                    Console.Error.WriteLine("Waiting for redis");
                     Thread.Sleep(1000);
                 }
             }