nickva commented on code in PR #5469:
URL: https://github.com/apache/couchdb/pull/5469#discussion_r1990070993
##########
src/nouveau/src/nouveau_api.erl:
##########
@@ -318,15 +318,34 @@ send_if_enabled(Url, Header, Method, Body) ->
send_if_enabled(Url, Header, Method, Body, Options) ->
case nouveau:enabled() of
true ->
- ibrowse:send_req(Url, Header, Method, Body, Options);
+ retry_if_connection_closes(fun() ->
+ ibrowse:send_req(Url, Header, Method, Body, Options)
+ end);
false ->
{error, nouveau_not_enabled}
end.
send_direct_if_enabled(ConnPid, Url, Header, Method, Body, Options) ->
case nouveau:enabled() of
true ->
- ibrowse:send_req_direct(ConnPid, Url, Header, Method, Body,
Options);
+ retry_if_connection_closes(fun() ->
+ ibrowse:send_req_direct(ConnPid, Url, Header, Method, Body,
Options)
+ end);
false ->
{error, nouveau_not_enabled}
end.
+
+retry_if_connection_closes(Fun) ->
+ MaxRetries = max(1, config:get_integer("nouveau", "max_retries", 5)),
+ retry_if_connection_closes(Fun, MaxRetries).
+
+retry_if_connection_closes(_Fun, 0) ->
+ {error, connection_closed};
Review Comment:
That makes sense, thanks for checking
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]