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:
28 files changed
+2619
-200
No files matched your search
@@ -107,6 +107,7 @@ Dentro il processo: `site.Control` (`SiteControl`). Da fuori: `/_controllo/...`
|
||||
| `/_controllo/modo?valore=normale`, `/_controllo/reimposta` | tutto torna normale |
|
||||
| `/_controllo/durata-storie?ms=` | quanto resta a schermo una storia prima che il visualizzatore vada avanti da solo |
|
||||
| `/_controllo/scadenza-indirizzi?secondi=` | durata degli indirizzi firmati consegnati da quel momento |
|
||||
| `/_controllo/cdn-troppe-richieste?valore=si\|no` | il CDN risponde 429 a ogni file (rallentamento chiesto dal CDN) |
|
||||
| `/_controllo/rinomina?da=&a=` | un account cambia nome (stesso numero) |
|
||||
| `/_controllo/ritratto?nome=` | nuova foto del profilo |
|
||||
| `/_controllo/pubblica?nome=&tipo=foto\|video\|serie` | nuovo post in cima |
|
||||
|
||||
@@ -38,6 +38,12 @@ public sealed class SiteControl
|
||||
/// <summary>Validity of the CDN addresses handed out from now on.</summary>
|
||||
public TimeSpan AddressLifetime { get; set; } = TimeSpan.FromHours(6);
|
||||
|
||||
/// <summary>The CDN answers 429 to every file (Rallentamento from the CDN, spec §7.6).</summary>
|
||||
public bool CdnTooManyRequests { get; set; }
|
||||
|
||||
/// <summary>Number of CDN requests answered with 429.</summary>
|
||||
public int CdnThrottled => _cdnThrottled;
|
||||
|
||||
/// <summary>Paths with query of every data request, in arrival order (for the tests).</summary>
|
||||
public IReadOnlyList<string> DataRequests => [.. _dataRequests];
|
||||
|
||||
@@ -49,6 +55,7 @@ public sealed class SiteControl
|
||||
|
||||
private int _cdnFiles;
|
||||
private int _cdnExpired;
|
||||
private int _cdnThrottled;
|
||||
|
||||
public StopMode Mode
|
||||
{
|
||||
@@ -83,8 +90,10 @@ public sealed class SiteControl
|
||||
_dataRequests.Clear();
|
||||
StoryDuration = TimeSpan.FromSeconds(5);
|
||||
AddressLifetime = TimeSpan.FromHours(6);
|
||||
CdnTooManyRequests = false;
|
||||
Interlocked.Exchange(ref _cdnFiles, 0);
|
||||
Interlocked.Exchange(ref _cdnExpired, 0);
|
||||
Interlocked.Exchange(ref _cdnThrottled, 0);
|
||||
}
|
||||
|
||||
public void ClearRequests() => _dataRequests.Clear();
|
||||
@@ -108,4 +117,6 @@ public sealed class SiteControl
|
||||
internal void OnCdnServed() => Interlocked.Increment(ref _cdnFiles);
|
||||
|
||||
internal void OnCdnExpired() => Interlocked.Increment(ref _cdnExpired);
|
||||
|
||||
internal void OnCdnThrottled() => Interlocked.Increment(ref _cdnThrottled);
|
||||
}
|
||||
@@ -307,6 +307,15 @@ public sealed class TestSite : IAsyncDisposable
|
||||
private async Task ServeCdnAsync(HttpContext context)
|
||||
{
|
||||
var path = context.Request.Path.Value ?? string.Empty;
|
||||
if (Control.CdnTooManyRequests)
|
||||
{
|
||||
Control.OnCdnThrottled();
|
||||
context.Response.StatusCode = 429;
|
||||
context.Response.ContentType = "text/plain; charset=utf-8";
|
||||
await context.Response.WriteAsync("Troppe richieste.").ConfigureAwait(false);
|
||||
return;
|
||||
}
|
||||
|
||||
var query = context.Request.Query;
|
||||
var check = Signer.Check(path, query["scad"].ToString(), query["firma"].ToString(), _time.GetUtcNow());
|
||||
if (check != CdnCheck.Valid)
|
||||
@@ -368,6 +377,9 @@ public sealed class TestSite : IAsyncDisposable
|
||||
case "durata-storie":
|
||||
Control.StoryDuration = TimeSpan.FromMilliseconds(int.Parse(q["ms"].ToString(), CultureInfo.InvariantCulture));
|
||||
break;
|
||||
case "cdn-troppe-richieste":
|
||||
Control.CdnTooManyRequests = q["valore"].ToString() is "si" or "sì" or "true";
|
||||
break;
|
||||
case "scadenza-indirizzi":
|
||||
Control.AddressLifetime = TimeSpan.FromSeconds(int.Parse(q["secondi"].ToString(), CultureInfo.InvariantCulture));
|
||||
break;
|
||||
|
||||
Reference in new issue
Block a user