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.
1 parent dea83e7 commit c57e9c3Copy full SHA for c57e9c3
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