ExternalService.ServiceSaturated exception (ExternalService v2.6.0)

Copy Markdown View Source

Raised or returned when a call could not be made because the service's concurrency limit was already fully in use.

This is an Errata infrastructure error. The same value is returned in an {:error, error} tuple by ExternalService.call/3 and raised by ExternalService.call!/3.

Its :context contains:

  • :service — the service the call was made against.
  • :limit — the configured concurrency limit.
  • :in_flight — how many slots were held when the call was rejected.

Only services configured with a :concurrency limit can produce this error. Its http_status/1 is the default 503: unlike ExternalService.RateLimited, this is not the external service refusing you, it is your own bulkhead shedding load — a "Service Unavailable" from your application.

Because the wrapped function never ran, this does not melt the circuit breaker and is not retried. Retrying immediately would only find the bulkhead full again; shedding is the point. See ExternalService.Concurrency.

Summary

Functions

Returns the HTTP status code associated with this error (503 by default).

Types

Functions

http_status(error)

@spec http_status(Errata.error()) :: non_neg_integer()

Returns the HTTP status code associated with this error (503 by default).

The default is derived from the error's kind, or set via the :http_status option. Override this function to compute a status from the error's :reason or :context. See also Errata.http_status/1.