Storico chiuso: la Coda non mostra più uno «Storico» da fare per quell'account

Quando lo storico si chiudeva con una corsa finita per un segnale o
un'interruzione, il compito dello Storico tornava in coda come «Fermata da un
segnale» o «Interrotta». Fino alla sessione dopo (dopo una verifica, fino a
«Riprendi») la Coda mostrava uno Storico da fare per un account già «Aggiornato» o
«In pausa». Lo stesso accadeva con lo storico chiuso dal controllo del profilo, e
per un account rimasto in pausa restavano in coda anche i suoi controlli
(rilievo F3 della revisione).

- La corsa dello Storico arrivata in fondo chiude il suo compito anche se poi si
  è fermata.
- FinishBackfillAsync toglie dalla coda lo Storico dell'account e, se l'account
  resta in pausa, tutto ciò che era pianificato per lui, come farebbe la sessione
  dopo. I comandi di Alberto restano.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Alby96andClaude Opus 5.5 committed 2026-10-20 16:02:23 +02:00
1 parent 9d959f910b
commit 9ce61d26ce
2 files changed
+54 -15

No files matched your search

+18 -2
View File
@@ -839,7 +839,12 @@ internal sealed class SessionComposer
case RecipeStatus.StoppedBySignal:
case RecipeStatus.Cancelled:
if (task is not null)
if (task is not null && kind == RecipeKind.Backfill && outcome.BackfillFinished)
{
// The walk got to the end before the run stopped: nothing to take up again (closed above).
writes.Add(Store.Tasks.CompleteAsync(task.Id, now, ct));
}
else if (task is not null)
{
await RequeueAsync(task, outcome.Status == RecipeStatus.Cancelled ? "Interrotta" : "Fermata da un segnale", now).ConfigureAwait(false);
}
@@ -1014,7 +1019,18 @@ internal sealed class SessionComposer
await Store.Accounts.SetBackfillAsync(account.Id, fresh.BackfillCursor, now, ct).ConfigureAwait(false);
var newState = fresh.KeepUpdated ? AccountState.UpToDate : AccountState.Paused;
await Store.Accounts.SetStateAsync(account.Id, newState, now, null, ct).ConfigureAwait(false);
var total = await Store.Entries.CountDiscoveredAsync(account.Id, EntryKind.Post, DateTimeOffset.UnixEpoch, now.AddSeconds(1), ct).ConfigureAwait(false);
// The Coda follows at once, not at the next session: no «Storico» left for the account, and nothing planned
// for an account that stays paused. Commands of Alberto stay; the task in flight is settled by its outcome.
foreach (var task in await Store.Tasks.ListPendingAsync(10_000, ct).ConfigureAwait(false))
{
if (task.AccountId == account.Id && !task.IsManual && (newState == AccountState.Paused || task.Kind == EngineTaskKind.Backfill))
{
await Store.Tasks.CancelAsync(task.Id, now, ct).ConfigureAwait(false);
}
}
var total =await Store.Entries.CountDiscoveredAsync(account.Id, EntryKind.Post, DateTimeOffset.UnixEpoch, now.AddSeconds(1), ct).ConfigureAwait(false);
var tail = fresh.KeepUpdated
? " Da ora lo tengo aggiornato."
: " «Tieni aggiornato» è spento: l'account resta in pausa.";