Method Create
- Namespace
- MailFathom.Infrastructure.Security.Transport
- Assembly
- MailFathom.Infrastructure.dll
Create(int, int, int, int, TimeSpan, int)
Creates the limits a transport surface runs under.
public static TransportRateLimits Create(int maxConcurrentRequests, int concurrencyQueueLimit, int tokenCapacity, int tokensPerReplenishmentPeriod, TimeSpan replenishmentPeriod, int requestQueueLimit)
Parameters
maxConcurrentRequestsintHow many requests the process serves at once on this surface.
concurrencyQueueLimitintHow many requests wait for a concurrency slot.
tokenCapacityintThe largest burst one caller may spend at once.
tokensPerReplenishmentPeriodintHow much capacity one caller gets back each period.
replenishmentPeriodTimeSpanHow often a caller's spent capacity is restored.
requestQueueLimitintHow many of one caller's requests wait for capacity.
Returns
- TransportRateLimits
The limits.
Remarks
The guards here are the invariants the type cannot exist without, not the ranges an operator is held to. A deployment's settings are checked against those before they reach this method, so that an operator reads every mistake at once instead of the first one to throw.
Exceptions
- ArgumentOutOfRangeException
Thrown when a value would leave the surface unbounded, unable to serve anything, unable to recover the capacity it hands out, or able to let one caller hold every concurrency permit.