Method WaitForSlotAsync
- Namespace
- MailFathom.Application.AiProviders
- Assembly
- MailFathom.Application.dll
WaitForSlotAsync(CancellationToken)
Waits until this deployment is allowed to send the paced workload's next request.
public Task WaitForSlotAsync(CancellationToken cancellationToken)
Parameters
cancellationTokenCancellationTokenAbandons the wait when the caller stops or the host shuts down.
Returns
- Task
A task that completes when the slot has arrived, immediately where nothing is paced.
Remarks
The slot is reserved in one statement and waited for afterwards, so a caller that has to wait a second does not hold every other caller behind it for that second — they take the slots after it and wait for their own. A deployment that paces nothing reaches no database, which is what keeps an unpaced workload as free as it was.
Exceptions
- OperationCanceledException
Thrown when the wait is cancelled, which leaves the reservation spent and the next caller no worse off than one slot.