Raccolta: 429 del CDN come rallentamento, attese crescenti e recupero dei falliti, storico e seguiti senza pagina di ripresa, lacuna sotto la prima pagina, eliminazioni durante lo scaricamento (regole-3, cdn-429, dl-1, post-loop, walk-1, check-1, scroll-1, reader-1, h9-1, ring-1, library-2, dedup-1, tmp-1, budget-1, regole-4, kind-1, vocab-1)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

Claude-Session: https://claude.ai/code/session_01Mzbb6zeFTjT6Rp8b92AVkA
This commit is contained in:
Claude committed 2026-10-14 00:23:03 +00:00
1 parent 78c92eb2a4
commit b16e3a837d
28 files changed
+2619 -200

No files matched your search

@@ -235,6 +235,29 @@ public sealed class StopAndDownloadIntegrationTests
Assert.IsTrue(posts.All(p => p.State == EntryState.Downloaded));
}
[TestMethod]
[Timeout(90_000, CooperativeCancellation = true)]
public async Task A429OfTheCdnDuringDownloadsIsAThrottleSignalThroughTheRealBrowser()
{
await using var h = await CollectionHarness.CreateAsync(Chromium);
var nadia = await h.AddAccountAsync("nadia.prova");
Assert.AreEqual(RecipeStatus.Completed, (await h.RunAsync(RecipeKind.ProfileCheck, nadia.Id)).Status);
var pending = await h.Db.Media.CountPendingDownloadsAsync();
h.Site.Control.CdnTooManyRequests = true;
// Network.loadNetworkResource is served outside the page: only the queue can tell the breaker.
var report = await h.Downloads.RunOnceAsync(CancellationToken.None);
Assert.IsNotNull(report.PausedUntil, report.ToString());
Assert.AreEqual(0, report.Stored + report.Failed + report.Retried, report.ToString());
var signal = h.Breaker.Signals.Single();
Assert.AreEqual(SignalLevel.Throttle, signal.Level);
Assert.AreEqual("http-429", signal.Code);
Assert.IsTrue(h.Site.Control.CdnThrottled is >= 1 and <= 2, $"The pass ended at once ({h.Site.Control.CdnThrottled} requests): at most the two downloads already under way.");
Assert.AreEqual(pending, await h.Db.Media.CountPendingDownloadsAsync(), "Every file is still waiting…");
var media = await Task.WhenAll((await h.Db.Entries.ListByAccountAsync(nadia.Id)).Select(e => h.Db.Media.ListByEntryAsync(e.Id)));
Assert.IsTrue(media.SelectMany(m => m).All(m => m.Attempts == 0), "…and none lost an attempt.");
}
[TestMethod]
[Timeout(90_000, CooperativeCancellation = true)]
public async Task DownloadsGoOnWhileTheSiteIsStoppedByAVerification()