Improved MySQL container boot handling
This will reduce the large error messages to a single line saying that the mysql container is still booting. Hopefully this fixes the login cli command as well
This commit is contained in:
parent
52bab229ea
commit
2cf03d4b68
1 changed files with 24 additions and 5 deletions
|
@ -6,6 +6,7 @@ using Moonlight.Core.Configuration;
|
||||||
using Moonlight.Core.Database;
|
using Moonlight.Core.Database;
|
||||||
using Moonlight.Core.Http.Middleware;
|
using Moonlight.Core.Http.Middleware;
|
||||||
using Moonlight.Core.Services;
|
using Moonlight.Core.Services;
|
||||||
|
using MySqlConnector;
|
||||||
|
|
||||||
// Create needed storage directories
|
// Create needed storage directories
|
||||||
Directory.CreateDirectory(PathBuilder.Dir("storage"));
|
Directory.CreateDirectory(PathBuilder.Dir("storage"));
|
||||||
|
@ -74,11 +75,29 @@ await featureService.Load();
|
||||||
var pluginService = new PluginService();
|
var pluginService = new PluginService();
|
||||||
await pluginService.Load();
|
await pluginService.Load();
|
||||||
|
|
||||||
// Check database migrations
|
try
|
||||||
await DatabaseCheckHelper.Check(
|
{
|
||||||
|
// Check database migrations
|
||||||
|
await DatabaseCheckHelper.Check(
|
||||||
new DataContext(configService),
|
new DataContext(configService),
|
||||||
false
|
false
|
||||||
);
|
);
|
||||||
|
}
|
||||||
|
catch (MySqlException e)
|
||||||
|
{
|
||||||
|
if (e.InnerException is EndOfStreamException eosException)
|
||||||
|
{
|
||||||
|
if (eosException.Message.Contains("read 4 header bytes"))
|
||||||
|
{
|
||||||
|
Logger.Warn("The mysql server appears to be still booting up. Exiting...");
|
||||||
|
|
||||||
|
Environment.Exit(1);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
|
||||||
// Add pre constructed services
|
// Add pre constructed services
|
||||||
builder.Services.AddSingleton(featureService);
|
builder.Services.AddSingleton(featureService);
|
||||||
|
|
Loading…
Reference in a new issue