Std.Admission
Std.Admission — a bound on the requests a server runs at the same time.
Types
type RouteClass = Rpc | Api
type alias Load = { routeClass : RouteClass , route : String , inFlight : Int , limit : Int , session : Maybe String }
type Decision = Admit | Throttle Int | Shed Int
type Policy
Values
install : Policy -> Task Error ()
Make the policy the process's policy. `App.withAdmission` does this for
limitOf : RouteClass -> Policy -> Int
The limit a policy sets for a class (`0`: none).
policy : Policy
No limit, no hook, a `Retry-After` of 1000 ms for a refusal.
retryAfterOf : Policy -> Int
The `Retry-After` of a refusal for the limit, in milliseconds.
withHook : (Request -> Load -> Task Error Decision) -> Policy -> Policy
`withHook decide` — run `decide` for each admitted request, after the
withLimit : RouteClass -> Int -> Policy -> Policy
`withLimit routeClass n` — at most `n` requests of the class run at the
withRetryAfter : Int -> Policy -> Policy
`withRetryAfter ms` — the `Retry-After` of a request refused for the