Method RecordSpendAsync
- Namespace
- MailFathom.Application.Retrieval.AskMail
- Assembly
- MailFathom.Application.dll
RecordSpendAsync(DateTimeOffset, long, CancellationToken)
Adds what one run consumed to the period it ended in.
Task<long> RecordSpendAsync(DateTimeOffset periodStart, long tokenCount, CancellationToken cancellationToken)
Parameters
periodStartDateTimeOffsetThe start of the period the run ended in, as the bounds place it — which, for a run that spanned a roll-over, is a later period than the one it was admitted into.
tokenCountlongThe tokens the run sent and received together, across every call it made.
cancellationTokenCancellationTokenCancels the write.
Returns
Remarks
Charged once as the run ends rather than once per provider call, which is the trade ADR 0031 took: a run already spends a provider's tokens, so one row touched beside that is not measurable, while a row touched per turn of a tool loop is. Expressed as an increment rather than as a read followed by a write, so two replicas answering at once add to each other instead of overwriting one another's total.
Exceptions
- ArgumentOutOfRangeException
Thrown when the count is negative.