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(); } }
private static void RemoveOldQuicksaves() { foreach (var vesselQuicksaveFolder in Directory.EnumerateDirectories(QuicksavesPath)) { var vesselId = Path.GetFileName(vesselQuicksaveFolder); if (vesselId == null) { continue; } if (!VesselStoreSystem.VesselExists(Guid.Parse(vesselId))) { Directory.Delete(vesselQuicksaveFolder, true); } } }
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(); }