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,
"SptTimings": {
"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(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);
}
}
}

View File

@ -17,6 +17,9 @@
/// </summary>
public string DateTimeFormat { get; set; }
/// <summary>
/// Default: False
/// </summary>
public bool QuickDumpEnabled { get; set; }
public SptTimings SptTimings { get; set; }
@ -33,5 +36,15 @@
/// Default: 5m * 60s * 1000ms = 300000ms
/// </summary>
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; }
}
}