Method CountOutstandingByStageAsync
- Namespace
- MailFathom.Application.Mail.Delivery
- Assembly
- MailFathom.Application.dll
CountOutstandingByStageAsync(MailAccountId, CancellationToken)
Counts how many of the account's sends stand at each stage nothing has finished with.
Task<IReadOnlyList<OutboxStageCount>> CountOutstandingByStageAsync(MailAccountId accountId, CancellationToken cancellationToken)
Parameters
accountIdMailAccountIdThe account whose sends are counted.
cancellationTokenCancellationTokenCancels the read.
Returns
- Task<IReadOnlyList<OutboxStageCount>>
One count per non-terminal stage, including the stages nothing stands at.
Remarks
It is a count rather than a reading because what it answers is a level: how much this account has waiting, which is the figure a delivery rate is a rate against. Nothing about any individual send reaches the answer, so it is publishable as the dimensions of a gauge.
A stage nothing stands at is reported as zero rather than left out, so an empty answer means the level was never measured and not that it is nothing. Whoever publishes it depends on that difference: a drained account has to report zero, while an account a pass never reached must keep whatever was last known about it rather than have its backlog cleared by a pass that did nothing.
Only the non-terminal stages are counted, which is what keeps it bounded: those are the rows the outstanding index covers, while everything this deployment has ever sent is history that grows without limit and would make a per-pass count a scan of it.