We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents dea83e7 + c57e9c3 commit d801ba9Copy full SHA for d801ba9
worker/src/Worker/Program.cs
@@ -40,17 +40,25 @@ public static int Main(string[] args)
40
41
private static NpgsqlConnection OpenDbConnection(string connectionString)
42
{
43
- var connection = new NpgsqlConnection(connectionString);
+ NpgsqlConnection connection;
44
+
45
while (true)
46
47
try
48
49
+ connection = new NpgsqlConnection(connectionString);
50
connection.Open();
51
break;
52
}
53
+ catch (SocketException)
54
+ {
55
+ Console.Error.WriteLine("Failed to connect to db - retrying");
56
+ Thread.Sleep(1000);
57
+ }
58
catch (DbException)
59
60
Console.Error.WriteLine("Failed to connect to db - retrying");
61
62
63
64
0 commit comments