|
@@ -71,14 +71,18 @@ public abstract class Engine<TProperties> : IEngine where TProperties : ServerPr
|
|
|
|
|
|
_connecting = true;
|
|
|
// Wait for server connection
|
|
|
- while (!Client.Ping())
|
|
|
+ while (_connecting)
|
|
|
{
|
|
|
- Logger.Send(LogType.Error, "", "Database server unavailable. Trying again in 30 seconds...");
|
|
|
- Task.Delay(30_000).Wait();
|
|
|
- Logger.Send(LogType.Information, "", "Retrying connection...");
|
|
|
+ Logger.Send(LogType.Information, "", "Connecting to Database server...");
|
|
|
+ if (Client.Ping())
|
|
|
+ _connecting = false;
|
|
|
+ else
|
|
|
+ {
|
|
|
+ Logger.Send(LogType.Error, "", "Database server unavailable. Trying again in 30 seconds...");
|
|
|
+ Task.Delay(30_000).Wait();
|
|
|
+ }
|
|
|
}
|
|
|
-
|
|
|
- _connecting = false;
|
|
|
+
|
|
|
|
|
|
ClientFactory.SetBypass();
|
|
|
|
|
@@ -99,6 +103,7 @@ public abstract class Engine<TProperties> : IEngine where TProperties : ServerPr
|
|
|
private void Transport_OnClose(IRpcTransport transport, RpcTransportCloseArgs e)
|
|
|
{
|
|
|
// Try to reconnect when lost connection.
|
|
|
+ Logger.Send(LogType.Error, "", "Database server connection lost.");
|
|
|
CheckConnection();
|
|
|
}
|
|
|
|