Ricette fatte di richieste, un permesso per richiesta (#36, S3)
Otto ricette (controllo del profilo, storico, taggati, reel, storie di un account, raccolta in evidenza, post singolo, elenco dei seguiti) hanno una strada per richieste dirette accanto a quella con il browser. Ci vanno solo se ogni ruolo che servono è un'operazione configurata di richieste.<sito>.json: con Instagram nessuna lo è e Febe non costruisce il client del sito, quindi il comportamento con Instagram non cambia fino a S4. Ogni richiesta prende il suo permesso dal Governatore nella categoria di ciò che chiede (la prima pagina dei post conta come profilo); i segnali delle risposte vanno all'interruttore e fermano la ricetta prima di ogni altra richiesta. Se manca un valore o la pagina successiva, la ricetta torna alle pagine per quella volta e il motore controlla tutti e due i tetti. I tetti non cambiano: il dimezzamento delle storie viste è tolto perché toccava anche il browser e i «Su misura» salvati, e resta una domanda per Alberto prima di S4. Il simulatore ha --raccolta pagine|richieste con il costo delle operazioni separate di Instagram: sei simulazioni di 30 giorni senza superamenti. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
4dcbd0b096
commit
63acae4e73
46 files changed
+3724
-136
No files matched your search
@@ -128,6 +128,13 @@ public interface IRecipeRunner
|
||||
/// would only end in <see cref="RecipeStatus.NotConfigured"/>.
|
||||
/// </summary>
|
||||
string? NotConfiguredReason(RecipeKind kind) => null;
|
||||
|
||||
/// <summary>
|
||||
/// The budget category the first action of <paramref name="kind"/> takes on the route this runner gives it (the
|
||||
/// engine skips the recipe when that budget is exhausted, and marks it exhausted after a refusal). By default the
|
||||
/// category of the recipe by the pages (<see cref="CheckPolicy.CategoryOf"/>).
|
||||
/// </summary>
|
||||
ActionKind FirstCategory(RecipeKind kind) => CheckPolicy.CategoryOf(kind);
|
||||
}
|
||||
|
||||
/// <summary>Daily byte budget for CDN downloads (category «dati scaricati», spec §7.4).</summary>
|
||||
|
||||
@@ -835,8 +835,10 @@ internal sealed class SessionComposer
|
||||
return null;
|
||||
}
|
||||
|
||||
var category = CheckPolicy.CategoryOf(request.Kind);
|
||||
if (state.Exhausted.Contains(category))
|
||||
// By requests a recipe can still go back to the pages for one run (a value missing, a next page without a
|
||||
// request), and its first action is then that of the pages: both budgets must have room.
|
||||
var category = _runner.FirstCategory(request.Kind);
|
||||
if (state.Exhausted.Contains(category) || state.Exhausted.Contains(CheckPolicy.CategoryOf(request.Kind)))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
@@ -1006,10 +1008,19 @@ internal sealed class SessionComposer
|
||||
await RequeueAsync(task, "Rimandata: tetto raggiunto", now).ConfigureAwait(false);
|
||||
}
|
||||
|
||||
var recheck = await _s.Governor.EvaluateBudgetAsync(CheckPolicy.CategoryOf(kind), request.AccountId, ct).ConfigureAwait(false);
|
||||
// The refusal may have come on the route of the requests or, gone back to them, of the pages.
|
||||
var first = _runner.FirstCategory(kind);
|
||||
var pages = CheckPolicy.CategoryOf(kind);
|
||||
if (pages != first
|
||||
&& (await _s.Governor.EvaluateBudgetAsync(pages, request.AccountId, ct).ConfigureAwait(false)).Reason is DenialReason.HourlyBudgetReached or DenialReason.DailyBudgetReached)
|
||||
{
|
||||
state.Exhausted.Add(pages);
|
||||
}
|
||||
|
||||
var recheck = await _s.Governor.EvaluateBudgetAsync(first, request.AccountId, ct).ConfigureAwait(false);
|
||||
if (recheck.Reason is DenialReason.HourlyBudgetReached or DenialReason.DailyBudgetReached)
|
||||
{
|
||||
state.Exhausted.Add(CheckPolicy.CategoryOf(kind));
|
||||
state.Exhausted.Add(first);
|
||||
}
|
||||
else if (recheck.Reason is DenialReason.BreakerOpen or DenialReason.OutsideActiveWindow or DenialReason.Paused or DenialReason.UserIsDriving)
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user