View Source Tesla.Middleware.Timeout (tesla v1.13.2)
Timeout HTTP request after X milliseconds.
Examples
defmodule MyClient do
def client do
Tesla.client([
Tesla.Middleware.Timeout,
timeout: 2_000
])
end
end
If you are using OpenTelemetry in your project, you may be interested in
using OpentelemetryProcessPropagator.Task
to have a better integration using
the task_module
option.
defmodule MyClient do
def client do
Tesla.client([
Tesla.Middleware.Timeout,
timeout: 2_000,
task_module: OpentelemetryProcessPropagator.Task
])
end
end
Options
:timeout
- number of milliseconds a request is allowed to take (defaults to1000
):task_module
- theTask
module used to spawn tasks. Useful when you want to use alternatives such asOpentelemetryProcessPropagator.Task
from the OTEL project.