Table of Contents

Method RecordAccountSpendAsync

Namespace
MailFathom.Application.Emails.Embeddings.Limits
Assembly
MailFathom.Application.dll

RecordAccountSpendAsync(IPersistenceSession, MailAccountId, long, CancellationToken)

Charges one provider call to the period it happened in and to every user the mailbox is assigned to.

public Task RecordAccountSpendAsync(IPersistenceSession session, MailAccountId account, long inputCharacterCount, CancellationToken cancellationToken)

Parameters

session IPersistenceSession

The session committing the vectors that call produced.

account MailAccountId

The mailbox whose mail the call was embedding.

inputCharacterCount long

The characters the call sent.

cancellationToken CancellationToken

Propagates caller cancellation.

Returns

Task

A task that completes when every charge has been issued inside the caller's transaction.

Remarks

Charged to whoever is assigned at the moment the call is made, and never recharged when an assignment changes: spend is a record of an event rather than a running apportionment. The deployment's own figure is charged once by the same write, so a mailbox assigned to nobody still moves it and a mailbox three people share moves it by what was sent rather than by three times it.

A deployment with no ceiling is charged exactly as one with a ceiling is. The count is what an operator watches to decide whether to declare a ceiling at all, so leaving it unwritten would make the figure appear only once it was already too late to be useful.

Exceptions

ArgumentNullException

Thrown when session is null.

ArgumentOutOfRangeException

Thrown when the count is negative.