34 lines
1.1 KiB
C#
34 lines
1.1 KiB
C#
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();
|
|
}
|
|
}
|
|
} |