From 0185cd0a0c9aca419278aed3b6af6990abdc91dc Mon Sep 17 00:00:00 2001 From: David De Jesus Duarte Date: Mon, 10 Mar 2025 15:52:19 +0100 Subject: [PATCH] retry: Consider http2 :disconnected and :read_only as transient Those correspond to two Finch issues: - https://github.com/sneako/finch/issues/216 - https://github.com/sneako/finch/issues/144 where retrying seems to be the only solution currently. --- lib/req/steps.ex | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/lib/req/steps.ex b/lib/req/steps.ex index d0f5364b..47758cff 100644 --- a/lib/req/steps.ex +++ b/lib/req/steps.ex @@ -2053,7 +2053,7 @@ defmodule Req.Steps do * `Req.TransportError` with `reason: :timeout | :econnrefused | :closed` - * `Req.HTTPError` with `protocol: :http2, reason: :unprocessed` + * `Req.HTTPError` with `protocol: :http2, reason: :unprocessed | :disconnected | :read_only` * `:transient` - same as `:safe_transient` except retries all HTTP methods (POST, DELETE, etc.) @@ -2176,6 +2176,16 @@ defmodule Req.Steps do true end + # See https://github.com/sneako/finch/issues/144 + defp transient?(%Req.HTTPError{protocol: :http2, reason: :disconnected}) do + true + end + + # See https://github.com/sneako/finch/issues/216 + defp transient?(%Req.HTTPError{protocol: :http2, reason: :read_only}) do + true + end + defp transient?(%{__exception__: true}) do false end