public static async void PerformBackups(CancellationToken token) { while (ServerContext.ServerRunning) { if (ServerContext.PlayerCount > 0) { LunaLog.Debug("Performing backups..."); VesselStoreSystem.BackupVessels(); WarpSystem.SaveLatestSubspaceToFile(); ScenarioStoreSystem.BackupScenarios(); } else { LunaLog.Debug("Skipping backups: No players online."); } try { await Task.Delay(IntervalSettings.SettingsStore.BackupIntervalMs, token); } catch (TaskCanceledException) { break; } } }
public static void RunBackup() { lock (LockObj) { LunaLog.Debug("Performing backups..."); VesselStoreSystem.BackupVessels(); WarpSystem.BackupSubspaces(); ScenarioStoreSystem.BackupScenarios(); } }
public static async void PerformBackups(CancellationToken token) { while (ServerContext.ServerRunning) { LunaLog.Debug("Performing backups..."); VesselStoreSystem.BackupVessels(); WarpSystem.SaveSubspacesToFile(); ScenarioStoreSystem.BackupScenarios(); try { await Task.Delay(IntervalSettings.SettingsStore.BackupIntervalMs, token); } catch (TaskCanceledException) { break; } } //Do a last backup before quitting VesselStoreSystem.BackupVessels(); WarpSystem.SaveSubspacesToFile(); ScenarioStoreSystem.BackupScenarios(); }