Method ReadCurrentPeriodForAccountAsync
- Namespace
- MailFathom.Application.Emails.Embeddings.Limits
- Assembly
- MailFathom.Application.dll
ReadCurrentPeriodForAccountAsync(MailAccountId, CancellationToken)
Reads where one mailbox stands in the current period, across every user it is assigned to.
public Task<EmbeddingSpendAdmission> ReadCurrentPeriodForAccountAsync(MailAccountId account, CancellationToken cancellationToken)
Parameters
accountMailAccountIdThe mailbox whose mail is about to be embedded.
cancellationTokenCancellationTokenCancels the read.
Returns
- Task<EmbeddingSpendAdmission>
The period, and the strictest standing among the mailbox's users beside the deployment's own.
Remarks
The strictest assigned user decides, because a shared mailbox's mail counts in full against each of them: work on it proceeds only while every one is under their ceiling, and a refusal therefore names the first that is not. A mailbox assigned to nobody is refused by the same rule read the other way: there is no user for the per-user ceiling to admit, so the answer is an exhausted per-user period rather than a fresh one. Admitting it instead would embed mail no caller can read — every caller-facing scope narrows to the accounts somebody is assigned — and would do so under no per-user ceiling at all, for as long as the mailbox stayed unassigned.
ponytail: one indexed read per assigned user. A mailbox is shared by a handful of people and the read sits beside a provider call costing orders of magnitude more, so a grouped read is worth writing only if a deployment ever assigns a mailbox widely enough for the count to show.
Exceptions
- OperationCanceledException
Thrown when the caller cancels.