0
0
mirror of https://github.com/sp-tarkov/assembly-tool.git synced 2025-02-12 16:50:44 -05:00

add retry count and delay

This commit is contained in:
CWX 2025-01-06 20:51:01 +00:00
parent 8884815de0
commit 433ff82c2e
3 changed files with 25 additions and 8 deletions

View File

@ -5,6 +5,8 @@
"QuickDumpEnabled": false, "QuickDumpEnabled": false,
"SptTimings": { "SptTimings": {
"SingleIterationDelayMs": 10000, "SingleIterationDelayMs": 10000,
"AllIterationDelayMs": 100000 "AllIterationDelayMs": 100000,
"RetriesBeforeQuit": 10,
"RetryDelayMs": 60000
} }
} }

View File

@ -33,9 +33,9 @@ namespace DumpLib
Utils.LogError("[Dumpy] Exception occured in SetupBackend"); Utils.LogError("[Dumpy] Exception occured in SetupBackend");
Utils.LogError(e); 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); MethodHelper.GetApplicationQuitMethod().Invoke(null, null);
} }
@ -44,6 +44,7 @@ namespace DumpLib
Utils.LogError("[Dumpy] Resetting backend and trying again"); Utils.LogError("[Dumpy] Resetting backend and trying again");
DataHelper.ClearVariables(); DataHelper.ClearVariables();
DataHelper.GotBackend = false; DataHelper.GotBackend = false;
await Task.Delay(DataHelper.ConfigSettings.SptTimings.RetryDelayMs);
} }
if (DataHelper.GotBackend) if (DataHelper.GotBackend)
@ -69,7 +70,7 @@ namespace DumpLib
.Invoke(DataHelper.Session, new[] { DataHelper.RaidSettings }); .Invoke(DataHelper.Session, new[] { DataHelper.RaidSettings });
// Artificial wait to hopefully keep BSG off our toes // Artificial wait to hopefully keep BSG off our toes
Utils.LogInfo("Waiting 10s"); Utils.LogInfo("[Dumpy] Waiting 10s");
await Task.Delay(10000); await Task.Delay(10000);
// "/client/match/local/start" // "/client/match/local/start"
@ -87,7 +88,7 @@ namespace DumpLib
DataHelper.LocalRaidSettings.GetType().GetField("serverId").SetValue(DataHelper.LocalRaidSettings, result2); DataHelper.LocalRaidSettings.GetType().GetField("serverId").SetValue(DataHelper.LocalRaidSettings, result2);
// Artificial wait to hopefully keep BSG off our toes // Artificial wait to hopefully keep BSG off our toes
Utils.LogInfo("Waiting 10s"); Utils.LogInfo("[Dumpy] Waiting 10s");
await Task.Delay(10000); await Task.Delay(10000);
// "/client/game/bot/generate" // "/client/game/bot/generate"
@ -97,7 +98,7 @@ namespace DumpLib
.Invoke(DataHelper.Session, new[] { DataHelper.WaveSettings }); .Invoke(DataHelper.Session, new[] { DataHelper.WaveSettings });
// Artificial wait to hopefully keep BSG off our toes // Artificial wait to hopefully keep BSG off our toes
Utils.LogInfo("Waiting 10s"); Utils.LogInfo("[Dumpy] Waiting 10s");
await Task.Delay(10000); await Task.Delay(10000);
var emptyArray = ReflectionHelper.CreateGenericMethod(typeof(Array).GetMethod("Empty"), TypeHelper.GetJsonTokenCreateType()) 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("[Dumpy] Exception occured in StartDumpyTask::Iteration");
Utils.LogError(e); 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); MethodHelper.GetApplicationQuitMethod().Invoke(null, null);
} }
@ -143,6 +144,7 @@ namespace DumpLib
Utils.LogError("[Dumpy] Resetting backend and trying again"); Utils.LogError("[Dumpy] Resetting backend and trying again");
DataHelper.ClearVariables(); DataHelper.ClearVariables();
await Task.Delay(DataHelper.ConfigSettings.SptTimings.RetryDelayMs);
} }
} }
} }

View File

@ -17,6 +17,9 @@
/// </summary> /// </summary>
public string DateTimeFormat { get; set; } public string DateTimeFormat { get; set; }
/// <summary>
/// Default: False
/// </summary>
public bool QuickDumpEnabled { get; set; } public bool QuickDumpEnabled { get; set; }
public SptTimings SptTimings { get; set; } public SptTimings SptTimings { get; set; }
@ -33,5 +36,15 @@
/// Default: 5m * 60s * 1000ms = 300000ms /// Default: 5m * 60s * 1000ms = 300000ms
/// </summary> /// </summary>
public int AllIterationDelayMs { get; set; } public int AllIterationDelayMs { get; set; }
/// <summary>
/// Default: 10 retries
/// </summary>
public int RetriesBeforeQuit { get; set; }
/// <summary>
/// Default: 1m * 60s * 1000ms = 60000ms
/// </summary>
public int RetryDelayMs { get; set; }
} }
} }