From ad18d190897ea49a5a985f74b1f0f0ece7b01bee Mon Sep 17 00:00:00 2001 From: Stefan Luptak Date: Sun, 22 Sep 2024 12:27:07 +0200 Subject: [PATCH] `retry`: Do not call `retry_delay` fun twice (#414) Closes #308 --- lib/req/steps.ex | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/lib/req/steps.ex b/lib/req/steps.ex index 6f19660..ce6404f 100644 --- a/lib/req/steps.ex +++ b/lib/req/steps.ex @@ -2109,14 +2109,12 @@ defmodule Req.Steps do fun when is_function(fun, 1) -> case fun.(retry_count) do delay when is_integer(delay) and delay >= 0 -> - delay + {request, delay} other -> raise ArgumentError, "expected :retry_delay function to return non-negative integer, got: #{inspect(other)}" end - - {request, fun.(retry_count)} end end