You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by to...@apache.org on 2016/05/30 23:15:07 UTC

[2/2] couch-replicator commit: updated refs/heads/3010-handle-429 to 7f0f3d7

Add random for next wait in maybe_retry

COUCHDB-3010


Project: http://git-wip-us.apache.org/repos/asf/couchdb-couch-replicator/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb-couch-replicator/commit/7f0f3d7e
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-couch-replicator/tree/7f0f3d7e
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-couch-replicator/diff/7f0f3d7e

Branch: refs/heads/3010-handle-429
Commit: 7f0f3d7e883be81946f1dbc0108649fc81772964
Parents: 665b0a7
Author: Tony Sun <to...@cloudant.com>
Authored: Mon May 30 16:17:09 2016 -0700
Committer: Tony Sun <to...@cloudant.com>
Committed: Mon May 30 16:17:09 2016 -0700

----------------------------------------------------------------------
 src/couch_replicator_httpc.erl | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb-couch-replicator/blob/7f0f3d7e/src/couch_replicator_httpc.erl
----------------------------------------------------------------------
diff --git a/src/couch_replicator_httpc.erl b/src/couch_replicator_httpc.erl
index 5013de3..f3fbd58 100644
--- a/src/couch_replicator_httpc.erl
+++ b/src/couch_replicator_httpc.erl
@@ -283,7 +283,8 @@ maybe_retry(Error, _Worker, #httpdb{retries = Retries, wait = Wait} = HttpDb,
     % backwards compatibility.
     ok = timer:sleep(erlang:min(Wait, ?MAX_WAIT)),
     Wait2 = erlang:min(Wait * 2, ?MAX_WAIT),
-    NewHttpDb = HttpDb#httpdb{retries = Retries - 1, wait = Wait2},
+    WaitR = random:uniform(Wait2),
+    NewHttpDb = HttpDb#httpdb{retries = Retries - 1, wait = WaitR},
     throw({retry, NewHttpDb, Params}).