Method WaitForSlotAsync
- Namespace
- MailFathom.Application.Emails.Embeddings.Limits
- Assembly
- MailFathom.Application.dll
WaitForSlotAsync(CancellationToken)
Waits until this deployment is allowed to send its next embedding 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 under the lock and waited for outside it, 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.
Exceptions
- OperationCanceledException
Thrown when the wait is cancelled, which leaves the reservation spent and the next caller no worse off than one slot.