diff --git a/Libraries/SPTarkov.Server.Core/Services/DatabaseService.cs b/Libraries/SPTarkov.Server.Core/Services/DatabaseService.cs index 0cf94be4..10eaa758 100644 --- a/Libraries/SPTarkov.Server.Core/Services/DatabaseService.cs +++ b/Libraries/SPTarkov.Server.Core/Services/DatabaseService.cs @@ -182,72 +182,4 @@ public class DatabaseService( return databaseServer.GetTables().Templates?.LocationServices!; } - - /// - /// Validates that the database doesn't contain invalid ID data - /// - public void ValidateDatabase() - { - var start = Stopwatch.StartNew(); - - _isDataValid = - ValidateTable(GetQuests(), "quest") - && ValidateTable(GetTraders(), "trader") - && ValidateTable(GetItems(), "item") - && ValidateTable(GetCustomization(), "customization"); - - if (!_isDataValid) - { - logger.Error(serverLocalisationService.GetText("database-invalid_data")); - } - - start.Stop(); - if (logger.IsLogEnabled(LogLevel.Debug)) - { - logger.Debug($"ID validation took: {start.ElapsedMilliseconds}ms"); - } - } - - /// - /// Validate that the given table only contains valid MongoIDs - /// - /// Table to validate for MongoIDs - /// The type of table, used in output message - /// True if the table only contains valid data - private bool ValidateTable(Dictionary table, string tableType) - { - foreach (var keyValuePair in table) - { - if (!keyValuePair.Key.IsValidMongoId()) - { - logger.Error($"Invalid {tableType} ID: '{keyValuePair.Key}'"); - return false; - } - } - - return true; - } - - private bool ValidateTable(Dictionary table, string tableType) - { - foreach (var keyValuePair in table) - { - if (!keyValuePair.Key.IsValidMongoId()) - { - logger.Error($"Invalid {tableType} ID: '{keyValuePair.Key}'"); - return false; - } - } - - return true; - } - - /// - /// Check if the database is valid - /// - /// True if the database contains valid data, false otherwise - public bool IsDatabaseValid() - { - return _isDataValid; - } } diff --git a/Libraries/SPTarkov.Server.Core/Services/PostDbLoadService.cs b/Libraries/SPTarkov.Server.Core/Services/PostDbLoadService.cs index beeaf3d4..0fa90947 100644 --- a/Libraries/SPTarkov.Server.Core/Services/PostDbLoadService.cs +++ b/Libraries/SPTarkov.Server.Core/Services/PostDbLoadService.cs @@ -42,15 +42,6 @@ public class PostDbLoadService( // add items gets left out,causing warnings itemBaseClassService.HydrateItemBaseClassCache(); - // Validate that only mongoIds exist in items, quests, and traders - // Kill the startup if not. - // TODO: We can probably remove this in a couple versions - databaseService.ValidateDatabase(); - if (!databaseService.IsDatabaseValid()) - { - throw new Exception("Server start failure, database invalid"); - } - AddCustomLooseLootPositions(); MergeCustomAchievements(); diff --git a/Libraries/SPTarkov.Server.Core/Utils/App.cs b/Libraries/SPTarkov.Server.Core/Utils/App.cs index 31205666..c7ad8938 100644 --- a/Libraries/SPTarkov.Server.Core/Utils/App.cs +++ b/Libraries/SPTarkov.Server.Core/Utils/App.cs @@ -78,15 +78,6 @@ public class App( { while (!appLifeTime.ApplicationStopping.IsCancellationRequested) { - // If the server has failed to start, skip any update calls - if (!databaseService.IsDatabaseValid()) - { - await Task.Delay(5000, appLifeTime.ApplicationStopping); - - // Skip forward to the next loop - continue; - } - foreach (var updateable in onUpdateComponents) { var updateableName = updateable.GetType().FullName;