Add timer to database

This commit is contained in:
Jesse
2025-02-13 15:22:46 +01:00
committed by Archangel
parent 87e1306f33
commit d96bd37bda
+6
View File
@@ -1,3 +1,4 @@
using System.Diagnostics;
using Core.DI;
using Core.Models.Eft.Common.Tables;
using Core.Models.Spt.Config;
@@ -141,6 +142,8 @@ public class DatabaseImporter : IOnLoad
protected async Task HydrateDatabase(string filePath)
{
_logger.Info(_localisationService.GetText("importing_database"));
Stopwatch timer = new();
timer.Start();
var dataToImport = await _importerUtil.LoadRecursiveAsync<DatabaseTables>(
$"{filePath}database/",
@@ -159,10 +162,13 @@ public class DatabaseImporter : IOnLoad
tempTraders.Add(tempKey, trader.Value);
}
timer.Stop();
dataToImport.Traders = tempTraders;
var validation = valid == ValidationResult.FAILED || valid == ValidationResult.NOT_FOUND ? "." : "";
_logger.Info($"{_localisationService.GetText("importing_database_finish")}{validation}");
this._logger.Debug($"Database import took {timer.ElapsedMilliseconds}ms");
_databaseServer.SetTables(dataToImport);
}