Table of Contents

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

maxConcurrentRequests int

How many requests the process serves at once on this surface.

concurrencyQueueLimit int

How many requests wait for a concurrency slot.

tokenCapacity int

The largest burst one caller may spend at once.

tokensPerReplenishmentPeriod int

How much capacity one caller gets back each period.

replenishmentPeriod TimeSpan

How often a caller's spent capacity is restored.

requestQueueLimit int

How 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.