Improved mysql container boot state error handling
This commit is contained in:
@@ -107,10 +107,26 @@ try
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
catch (MySqlException e)
|
catch (MySqlException e)
|
||||||
|
{
|
||||||
|
bool IsBootException(MySqlException e)
|
||||||
{
|
{
|
||||||
if (e.InnerException is EndOfStreamException eosException)
|
if (e.InnerException is EndOfStreamException eosException)
|
||||||
{
|
{
|
||||||
if (eosException.Message.Contains("read 4 header bytes"))
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (IsBootException(e))
|
||||||
{
|
{
|
||||||
preRunLogger.LogWarning("The mysql server appears to be still booting up. Exiting...");
|
preRunLogger.LogWarning("The mysql server appears to be still booting up. Exiting...");
|
||||||
|
|
||||||
@@ -119,9 +135,6 @@ catch (MySqlException e)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
throw;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Add pre constructed services
|
// Add pre constructed services
|
||||||
builder.Services.AddSingleton(featureService);
|
builder.Services.AddSingleton(featureService);
|
||||||
builder.Services.AddSingleton(configService);
|
builder.Services.AddSingleton(configService);
|
||||||
|
|||||||
Reference in New Issue
Block a user