summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan Lehnardt <jan@apache.org>2018-07-16 12:47:23 +0200
committerJan Lehnardt <jan@apache.org>2018-07-17 09:54:52 +0200
commit6ed65e83e572cc28832d90c3bc2f88a246b5a6d6 (patch)
treec9aa4ba48055bb71aa90d0e680e7f7d176a53f06
parent1d697901a283d4abc38916a1c883bd5b8c47155f (diff)
downloadcouchdb-6ed65e83e572cc28832d90c3bc2f88a246b5a6d6.tar.gz
add retry to test_request:request()
-rw-r--r--src/couch/src/test_request.erl6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/couch/src/test_request.erl b/src/couch/src/test_request.erl
index 4dfde1a33..48f49bda6 100644
--- a/src/couch/src/test_request.erl
+++ b/src/couch/src/test_request.erl
@@ -101,7 +101,11 @@ request(Method, Url, Headers, Body, Opts, N) ->
{error, {'EXIT', {normal, _}}} ->
% Connection closed right after a successful request that
% used the same connection.
- request(Method, Url, Headers, Body, N - 1);
+ request(Method, Url, Headers, Body, Opts, N - 1);
+ {error, retry_later} ->
+ % CouchDB is busy, let’s wait a bit
+ timer:sleep(3000 div N),
+ request(Method, Url, Headers, Body, Opts, N - 1);
Error ->
Error
end.