Consistently use randomized delays

This commit is contained in:
Matt Nadareski
2026-02-28 11:11:00 -05:00
parent 1caa784210
commit 7eb35d11ac
3 changed files with 14 additions and 9 deletions

View File

@@ -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;

View File

@@ -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");

View File

@@ -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;