Implemented installation handling. Added crash handling. Refactored tasks reset/cancel functions

This commit is contained in:
2025-02-14 21:15:03 +01:00
parent 761ab455f0
commit 1fbf1ae9ec
12 changed files with 264 additions and 44 deletions

View File

@@ -0,0 +1,34 @@
using Docker.DotNet;
using Docker.DotNet.Models;
namespace MoonlightServers.Daemon.Abstractions;
public partial class Server
{
public async Task InternalCrash()
{
var dockerClient = ServiceProvider.GetRequiredService<DockerClient>();
ContainerInspectResponse? container;
try
{
container = await dockerClient.Containers.InspectContainerAsync(RuntimeContainerId);
}
catch (DockerContainerNotFoundException)
{
container = null;
}
if(container == null)
return;
var exitCode = container.State.ExitCode;
// TODO: Report to panel
await LogToConsole($"Server crashed. Exit code: {exitCode}");
await Destroy();
}
}