From 7eb35d11ac04c4fc22401a2503ae4d4e23ba2176 Mon Sep 17 00:00:00 2001 From: Matt Nadareski Date: Sat, 28 Feb 2026 11:11:00 -0500 Subject: [PATCH] Consistently use randomized delays --- SabreTools.RedumpLib/Web/Discs.cs | 5 ++++- SabreTools.RedumpLib/Web/RedumpClient.cs | 13 ++++++------- SabreTools.RedumpLib/Web/WIP.cs | 5 ++++- 3 files changed, 14 insertions(+), 9 deletions(-) diff --git a/SabreTools.RedumpLib/Web/Discs.cs b/SabreTools.RedumpLib/Web/Discs.cs index 138bca5..02c417b 100644 --- a/SabreTools.RedumpLib/Web/Discs.cs +++ b/SabreTools.RedumpLib/Web/Discs.cs @@ -158,7 +158,10 @@ namespace SabreTools.RedumpLib.Web { ids.Add(id); if (await rc.DownloadSingleSiteID(id, outDir, true)) - DelayHelper.DelayRandom(); // Intentional sleep here so we don't flood the server + { + // Intentional delay here so we don't flood the server + DelayHelper.DelayRandom(); + } } return ids; diff --git a/SabreTools.RedumpLib/Web/RedumpClient.cs b/SabreTools.RedumpLib/Web/RedumpClient.cs index c45ee04..a990449 100644 --- a/SabreTools.RedumpLib/Web/RedumpClient.cs +++ b/SabreTools.RedumpLib/Web/RedumpClient.cs @@ -8,7 +8,6 @@ using System.Net.Http.Headers; #endif using System.Text; using System.Text.RegularExpressions; -using System.Threading; using System.Threading.Tasks; using SabreTools.RedumpLib.Data; @@ -240,8 +239,8 @@ namespace SabreTools.RedumpLib.Web } catch { } - // Sleep for 100ms if the last attempt failed - Thread.Sleep(100); + // Intentional delay here so we don't flood the server + DelayHelper.DelayRandom(); } Console.Error.WriteLine($"Could not download \"{uri}\" after {AttemptCount} attempts"); @@ -297,8 +296,8 @@ namespace SabreTools.RedumpLib.Web } catch { } - // Sleep for 100ms if the last attempt failed - Thread.Sleep(100); + // Intentional delay here so we don't flood the server + DelayHelper.DelayRandom(); } Console.Error.WriteLine($"Could not download \"{uri}\" after {AttemptCount} attempts"); @@ -331,8 +330,8 @@ namespace SabreTools.RedumpLib.Web } catch { } - // Sleep for 100ms if the last attempt failed - Thread.Sleep(100); + // Intentional delay here so we don't flood the server + DelayHelper.DelayRandom(); } Console.Error.WriteLine($"Could not download \"{uri}\" after {AttemptCount} attempts"); diff --git a/SabreTools.RedumpLib/Web/WIP.cs b/SabreTools.RedumpLib/Web/WIP.cs index ca9a512..6ff4e68 100644 --- a/SabreTools.RedumpLib/Web/WIP.cs +++ b/SabreTools.RedumpLib/Web/WIP.cs @@ -43,7 +43,10 @@ namespace SabreTools.RedumpLib.Web { ids.Add(id); if (await rc.DownloadSingleWIPID(id, outDir, true)) - DelayHelper.DelayRandom(); // Intentional sleep here so we don't flood the server + { + // Intentional delay here so we don't flood the server + DelayHelper.DelayRandom(); + } } return ids;