Method TryAdmitRunAsync
- Namespace
- MailFathom.Application.Retrieval.AskMail
- Assembly
- MailFathom.Application.dll
TryAdmitRunAsync(DateTimeOffset, int, long, CancellationToken)
Takes an allowance for one run against the deployment's period, only where both ceilings still have room.
Task<int> TryAdmitRunAsync(DateTimeOffset periodStart, int maximumRuns, long maximumTokens, CancellationToken cancellationToken)
Parameters
periodStartDateTimeOffsetThe period's start, as the bounds place it.
maximumRunsintThe greatest number of runs this period may admit.
maximumTokenslongThe greatest number of tokens the runs of this period may consume.
cancellationTokenCancellationTokenCancels the admission.
Returns
Remarks
One statement rather than a read and a decision, because every replica admits against the same row: a read-modify-write would let each of them find room the others had already taken. The run is counted by the act of admitting it rather than when it finishes, so a run still in flight already occupies its place.
Exceptions
- ArgumentOutOfRangeException
Thrown when either ceiling is below one.