You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by rn...@apache.org on 2025/08/22 20:40:45 UTC

(couchdb) 03/05: retry if no connection available

This is an automated email from the ASF dual-hosted git repository.

rnewson pushed a commit to branch nouveau-improvements
in repository https://gitbox.apache.org/repos/asf/couchdb.git

commit 8638c8735772230528cfba1fa711dc5809f72a30
Author: Robert Newson <rn...@apache.org>
AuthorDate: Thu Aug 7 12:14:02 2025 +0100

    retry if no connection available
---
 src/nouveau/src/nouveau_api.erl | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/src/nouveau/src/nouveau_api.erl b/src/nouveau/src/nouveau_api.erl
index 73aff2c1f..64f5a948a 100644
--- a/src/nouveau/src/nouveau_api.erl
+++ b/src/nouveau/src/nouveau_api.erl
@@ -281,6 +281,9 @@ send_if_enabled(Path, ReqHeaders, Method) ->
     send_if_enabled(Path, ReqHeaders, Method, <<>>).
 
 send_if_enabled(Path, ReqHeaders, Method, ReqBody) ->
+    send_if_enabled(Path, ReqHeaders, Method, ReqBody, 5).
+
+send_if_enabled(Path, ReqHeaders, Method, ReqBody, RemainingTries) ->
     case nouveau:enabled() of
         true ->
             case
@@ -306,6 +309,9 @@ send_if_enabled(Path, ReqHeaders, Method, ReqBody) ->
                         {error, Reason} ->
                             {error, Reason}
                     end;
+                {error, no_connection_available, _Reason} when RemainingTries > 0 ->
+                    timer:sleep(1000),
+                    send_if_enabled(Path, ReqHeaders, Method, ReqBody, RemainingTries - 1);
                 {error, _Type, Reason} ->
                     {error, Reason}
             end;