diff --git a/DumpLib/DUMPDATA/config.json b/DumpLib/DUMPDATA/config.json index 0c384a0..02467cb 100644 --- a/DumpLib/DUMPDATA/config.json +++ b/DumpLib/DUMPDATA/config.json @@ -5,6 +5,8 @@ "QuickDumpEnabled": false, "SptTimings": { "SingleIterationDelayMs": 10000, - "AllIterationDelayMs": 100000 + "AllIterationDelayMs": 100000, + "RetriesBeforeQuit": 10, + "RetryDelayMs": 60000 } } \ No newline at end of file diff --git a/DumpLib/DumpyTool.cs b/DumpLib/DumpyTool.cs index 279de51..830a7d0 100644 --- a/DumpLib/DumpyTool.cs +++ b/DumpLib/DumpyTool.cs @@ -33,9 +33,9 @@ namespace DumpLib Utils.LogError("[Dumpy] Exception occured in SetupBackend"); Utils.LogError(e); - if (DataHelper.ErrorCounter >= 3) + if (DataHelper.ErrorCounter >= DataHelper.ConfigSettings.SptTimings.RetriesBeforeQuit) { - Utils.LogError("[Dumpy] ErrorsCounter was 3, exiting app!"); + Utils.LogError($"[Dumpy] ErrorsCounter was {DataHelper.ConfigSettings.SptTimings.RetriesBeforeQuit}, exiting app!"); MethodHelper.GetApplicationQuitMethod().Invoke(null, null); } @@ -44,6 +44,7 @@ namespace DumpLib Utils.LogError("[Dumpy] Resetting backend and trying again"); DataHelper.ClearVariables(); DataHelper.GotBackend = false; + await Task.Delay(DataHelper.ConfigSettings.SptTimings.RetryDelayMs); } if (DataHelper.GotBackend) @@ -69,7 +70,7 @@ namespace DumpLib .Invoke(DataHelper.Session, new[] { DataHelper.RaidSettings }); // Artificial wait to hopefully keep BSG off our toes - Utils.LogInfo("Waiting 10s"); + Utils.LogInfo("[Dumpy] Waiting 10s"); await Task.Delay(10000); // "/client/match/local/start" @@ -87,7 +88,7 @@ namespace DumpLib DataHelper.LocalRaidSettings.GetType().GetField("serverId").SetValue(DataHelper.LocalRaidSettings, result2); // Artificial wait to hopefully keep BSG off our toes - Utils.LogInfo("Waiting 10s"); + Utils.LogInfo("[Dumpy] Waiting 10s"); await Task.Delay(10000); // "/client/game/bot/generate" @@ -97,7 +98,7 @@ namespace DumpLib .Invoke(DataHelper.Session, new[] { DataHelper.WaveSettings }); // Artificial wait to hopefully keep BSG off our toes - Utils.LogInfo("Waiting 10s"); + Utils.LogInfo("[Dumpy] Waiting 10s"); await Task.Delay(10000); var emptyArray = ReflectionHelper.CreateGenericMethod(typeof(Array).GetMethod("Empty"), TypeHelper.GetJsonTokenCreateType()) @@ -133,9 +134,9 @@ namespace DumpLib Utils.LogError("[Dumpy] Exception occured in StartDumpyTask::Iteration"); Utils.LogError(e); - if (DataHelper.ErrorCounter >= 3) + if (DataHelper.ErrorCounter >= DataHelper.ConfigSettings.SptTimings.RetriesBeforeQuit) { - Utils.LogError("[Dumpy] ErrorsCounter was 3, exiting app"); + Utils.LogError($"[Dumpy] ErrorsCounter was {DataHelper.ConfigSettings.SptTimings.RetriesBeforeQuit}, exiting app"); MethodHelper.GetApplicationQuitMethod().Invoke(null, null); } @@ -143,6 +144,7 @@ namespace DumpLib Utils.LogError("[Dumpy] Resetting backend and trying again"); DataHelper.ClearVariables(); + await Task.Delay(DataHelper.ConfigSettings.SptTimings.RetryDelayMs); } } } diff --git a/DumpLib/Models/SptConfigClass.cs b/DumpLib/Models/SptConfigClass.cs index 0d87c18..28cded5 100644 --- a/DumpLib/Models/SptConfigClass.cs +++ b/DumpLib/Models/SptConfigClass.cs @@ -17,6 +17,9 @@ /// public string DateTimeFormat { get; set; } + /// + /// Default: False + /// public bool QuickDumpEnabled { get; set; } public SptTimings SptTimings { get; set; } @@ -33,5 +36,15 @@ /// Default: 5m * 60s * 1000ms = 300000ms /// public int AllIterationDelayMs { get; set; } + + /// + /// Default: 10 retries + /// + public int RetriesBeforeQuit { get; set; } + + /// + /// Default: 1m * 60s * 1000ms = 60000ms + /// + public int RetryDelayMs { get; set; } } } \ No newline at end of file