Improved mysql container boot state error handling

This commit is contained in:
Marcel Baumgartner
2024-06-24 19:30:20 +02:00
parent 42e9f18fb6
commit 7fcd674b7f

View File

@@ -108,18 +108,31 @@ try
}
catch (MySqlException e)
{
if (e.InnerException is EndOfStreamException eosException)
bool IsBootException(MySqlException e)
{
if (eosException.Message.Contains("read 4 header bytes"))
if (e.InnerException is EndOfStreamException eosException)
{
preRunLogger.LogWarning("The mysql server appears to be still booting up. Exiting...");
Environment.Exit(1);
return;
if (!eosException.Message.Contains("read 4 header bytes"))
return false;
}
else if (e.InnerException is MySqlEndOfStreamException endOfStreamException)
{
if (!endOfStreamException.Message.Contains("An incomplete response was received from the server"))
return false;
}
else
return false;
return true;
}
throw;
if (IsBootException(e))
{
preRunLogger.LogWarning("The mysql server appears to be still booting up. Exiting...");
Environment.Exit(1);
return;
}
}
// Add pre constructed services