Reword connection retry messages

This commit is contained in:
Aanand Prasad 2016-06-19 21:32:18 -07:00
parent 82fd54e28f
commit 036c119e2c
2 changed files with 7 additions and 4 deletions

View File

@ -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);
});

View File

@ -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);
}
}