View Source Tesla.Middleware.Timeout (tesla v1.12.1)
Timeout HTTP request after X milliseconds.
Examples
defmodule MyClient do
use Tesla
plug Tesla.Middleware.Timeout, timeout: 2_000
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
use Tesla
plug Tesla.Middleware.Timeout,
timeout: 2_000,
task_module: OpentelemetryProcessPropagator.Task
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 use alternatives such asOpentelemetryProcessPropagator.Task
from OTEL project.