BexioApiClient.Req.RewriteDelay (bexio_api_client v0.9.0)

This module just handles the normal Bexio API rate limit headers as well as the (observed) regular exceptions to retry. With status code 429 we try to read the header "ratelimit-reset" and send back the {:delay, delay} tuple. In case of 408, 500, 502, 503, 504 we fall back to the retry mechanism.

telemetry-events

Telemetry Events

This module emits the following telemetry events:

  • [:bexio_api_client, :rate_limit, :hit] - Emitted when a 429 rate limit response is received. Measurements: %{reset_seconds: integer()} Metadata: %{has_reset_header: boolean()}

  • [:bexio_api_client, :request, :retry] - Emitted when a request will be retried due to server errors. Measurements: %{count: 1} Metadata: %{status: integer()}

  • [:bexio_api_client, :request, :success] - Emitted when a request completes successfully (status 200-399). Measurements: %{count: 1} Metadata: %{status: integer()}

  • [:bexio_api_client, :request, :error] - Emitted when a request completes with an error (status 400+). Measurements: %{count: 1} Metadata: %{status: integer()}

Link to this section Summary

Link to this section Functions

Link to this function

retry(request, response_or_exception)

@spec retry(Req.Request.t(), any()) :: boolean() | {:delay, integer()}