This commit is contained in:
2022-09-10 22:14:00 +00:00
parent 628364bcaa
commit 4c9fc68ef7
2 changed files with 8 additions and 14 deletions

View File

@@ -9,7 +9,7 @@ Problem:
potential fixes: TODO HERE:
Detect postgres is unreachable and stop digging a hole, wait to resolve it before continuing on again
Don't log same message repeatedly
actually this is not necessary if just stop running jobs when can't reach sql server
FIXED don't dual log to system journal logs and ayanova log
@@ -40,6 +40,10 @@ Npgsql.NpgsqlException (0x80004005): Failed to connect to 127.0.0.1:5432
System.Net.Sockets.SocketException (10054): An existing connection was forcibly closed by the remote host.
System.Net.Sockets.SocketException (10061): No connection could be made because the target machine actively refused it.
ex.source "Npgsql.EntityFrameworkCore.PostgreSQL","Npgsql"
ex.message "An exception has been raised that is likely due to a transient failure.","Exception while writing to stream","Unable to write data to the transport connection: An existing connection was forcibly closed by the remote host.."
Boot exception when db is not up:
{Npgsql.NpgsqlException (0x80004005): Failed to connect to 127.0.0.1:5432
---> System.Net.Sockets.SocketException (10061): No connection could be made because the target machine actively refused it.

View File

@@ -239,20 +239,10 @@ namespace AyaNova.Util
internal static void HandleIfDatabaseUnavailableTypeException(Exception ex)
{
if (ex == null) return;
//System.Net.Sockets.SocketException (10054): An existing connection was forcibly closed by the remote host.
//System.Net.Sockets.SocketException (10061): No connection could be made because the target machine actively refused it.
do
{
if (ex.Message.Contains("SOMESTRING"))
{
ServerGlobalOpsSettingsCache.DBAVAILABLE = true;
return;
}
ex = ex.InnerException;
//ServerGlobalOpsSettingsCache.DBAVAILABLE = true;
} while (ex != null);
if (ex.Message.Contains("transient failure") && ex.Source.Contains("PostgreSQL"))
ServerGlobalOpsSettingsCache.DBAVAILABLE = false;
}
///////////////////////////////////////////
//Verify that database exists, if not, then create it