Interface IProviderPaceMarker
- Namespace
- MailFathom.Application.AiProviders
- Assembly
- MailFathom.Application.dll
Hands out the slots one paced workload's requests are sent in, across every replica of one deployment.
public interface IProviderPaceMarker
Remarks
The marker is one instant per workload — when the next request may go out — and reserving a slot is moving it forward by one interval and being told what the caller reserved. It is durable rather than a field because a rate is what a provider states about the deployment: three replicas each pacing themselves send three times what their operator declared, at a provider that answers a per-minute quota with a refusal. ADR 0031 records why a rate moves into the database while an in-flight count stays a process's.
A reservation is spent whether or not the caller waits for it. That is what a slot reservation means and it is the same promise the in-process marker made: a caller that gave up leaves the next one no worse off than one slot, and nothing has to be given back for the rate to keep holding.
What comes back is how long to wait rather than when the slot falls, because both instants are the database's and only their difference is meaningful to a replica whose own clock may sit anywhere. Subtracting them where they were measured is what keeps a drifting clock from turning a rate into a burst.
Methods
- ReserveNextSlotAsync(string, TimeSpan, CancellationToken)
Takes the paced workload's next slot and reports how long its caller has to wait for it.