Implemented statistics. Refactored storage abstractions. Added config options for docker and local storage. Added server service and server updating.
This commit is contained in:
34
MoonlightServers.Daemon/ServerSystem/Server.Update.cs
Normal file
34
MoonlightServers.Daemon/ServerSystem/Server.Update.cs
Normal file
@@ -0,0 +1,34 @@
|
||||
namespace MoonlightServers.Daemon.ServerSystem;
|
||||
|
||||
public partial class Server
|
||||
{
|
||||
public async Task UpdateAsync()
|
||||
{
|
||||
await Lock.WaitAsync();
|
||||
|
||||
try
|
||||
{
|
||||
if (State is ServerState.Online or ServerState.Starting or ServerState.Stopping)
|
||||
{
|
||||
Logger.LogTrace("Fetching latest runtime configuration");
|
||||
RuntimeConfiguration = await ConfigurationService.GetRuntimeConfigurationAsync(Uuid);
|
||||
|
||||
if (RuntimeEnvironment != null)
|
||||
{
|
||||
Logger.LogTrace("Updating runtime environment");
|
||||
await RuntimeEnvironmentService.UpdateAsync(RuntimeEnvironment, RuntimeConfiguration);
|
||||
}
|
||||
|
||||
if (RuntimeStorage != null)
|
||||
{
|
||||
Logger.LogTrace("Updating runtime storage");
|
||||
await RuntimeStorageService.UpdateAsync(RuntimeStorage, RuntimeConfiguration);
|
||||
}
|
||||
}
|
||||
}
|
||||
finally
|
||||
{
|
||||
Lock.Release();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user