Skip to content

Commit 40d3a3e

Browse files
committed
Increased retry attempts to 4
Fixed reuploader log duplication
1 parent 2fc59b9 commit 40d3a3e

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

Forms/FormMain.cs

+6-6
Original file line numberDiff line numberDiff line change
@@ -746,7 +746,6 @@ internal async Task HttpUploadLogAsync(string file, Dictionary<string, string> p
746746
AddToText($">:> Uploading {Path.GetFileName(file)}");
747747
var request = new RestRequest(CreateDPSReportLink());
748748
request.AddBody(postData);
749-
var bossId = 1;
750749
try
751750
{
752751
request.AddFile("file", file);
@@ -799,7 +798,7 @@ internal async Task HttpUploadLogAsync(string file, Dictionary<string, string> p
799798
AddToText($">:> Despite the error, log link has been generated, processing upload...");
800799
}
801800
}
802-
bossId = reportJson.Encounter.BossId;
801+
var bossId = reportJson.Encounter.BossId;
803802
var success = (reportJson.Encounter.Success ?? false) ? "true" : "false";
804803
lastLogBossCM = reportJson.ChallengeMode;
805804
// extra JSON from Elite Insights
@@ -891,10 +890,10 @@ internal async Task HttpUploadLogAsync(string file, Dictionary<string, string> p
891890
if (uploadFailCounters.TryGetValue(file, out int uploadFailCounter))
892891
{
893892
uploadFailCounters[file]++;
894-
if (uploadFailCounter > 3)
893+
if (uploadFailCounter > 4)
895894
{
896895
uploadFailCounters.Remove(file);
897-
AddToText($">:> Upload retry failed 3 times for {Path.GetFileName(file)}, will try again in 15m.");
896+
AddToText($">:> Upload retry failed 4 times for {Path.GetFileName(file)}, will try again in 15 minutes.");
898897
LogReuploader.FailedLogs.Add(file);
899898
LogReuploader.SaveFailedLogs();
900899
timerFailedLogsReupload.Enabled = true;
@@ -905,8 +904,9 @@ internal async Task HttpUploadLogAsync(string file, Dictionary<string, string> p
905904
{
906905
var delay = uploadFailCounter switch
907906
{
908-
3 => 45000,
909-
2 => 15000,
907+
4 => 180000,
908+
3 => 90000,
909+
2 => 30000,
910910
_ => 3000,
911911
};
912912
AddToText($">:> Retrying in {delay / 1000}s...");

Tools/LogReuploader.cs

+3-3
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,14 @@ internal static class LogReuploader
1212
{
1313
internal static readonly string fileLocation = $@"{ApplicationSettings.LocalDir}\faileduploads.txt";
1414

15-
private static List<string> _failedLogs;
15+
private static HashSet<string> _failedLogs;
1616
private static readonly Dictionary<string, string> postData = new()
1717
{
1818
{ "generator", "ei" },
1919
{ "json", "1" }
2020
};
2121

22-
internal static List<string> FailedLogs
22+
internal static HashSet<string> FailedLogs
2323
{
2424
get
2525
{
@@ -29,7 +29,7 @@ internal static List<string> FailedLogs
2929
{
3030
try
3131
{
32-
_failedLogs = File.ReadAllLines(fileLocation).Where(File.Exists).Distinct().ToList();
32+
_failedLogs = File.ReadAllLines(fileLocation).Where(File.Exists).ToHashSet();
3333
}
3434
catch
3535
{

0 commit comments

Comments
 (0)