You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by da...@apache.org on 2014/01/17 23:06:46 UTC
[12/50] git commit: Do a better job of breaking the race
Do a better job of breaking the race
BugzID: 13405
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/11d8c162
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-couch-replicator/tree/11d8c162
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-couch-replicator/diff/11d8c162
Branch: refs/heads/import
Commit: 11d8c16202859870dff8def6cfdbcc97ac067a38
Parents: e1b7cc1
Author: Bob Dionne <bo...@cloudant.com>
Authored: Thu Aug 2 13:24:29 2012 -0400
Committer: Paul J. Davis <pa...@gmail.com>
Committed: Wed Mar 20 06:02:37 2013 -0500
----------------------------------------------------------------------
src/couch_replicator.erl | 7 ++-----
1 file changed, 2 insertions(+), 5 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/couchdb-couch-replicator/blob/11d8c162/src/couch_replicator.erl
----------------------------------------------------------------------
diff --git a/src/couch_replicator.erl b/src/couch_replicator.erl
index d02f5e6..ccafb97 100644
--- a/src/couch_replicator.erl
+++ b/src/couch_replicator.erl
@@ -141,11 +141,8 @@ async_replicate(#rep{id = {BaseId, Ext}, source = Src, target = Tgt} = Rep) ->
%% this error occurs if multiple replicators are racing
%% each other to start and somebody else won. Just grab
%% the Pid by calling start_child again.
- {error, {already_started, Pid}} =
- supervisor:start_child(couch_replicator_job_sup, ChildSpec),
- twig:log(notice,"replication `~s` already running at ~p (`~s` -> `~s`)",
- [RepChildId, Pid, Source, Target]),
- {ok, Pid};
+ timer:sleep(50 + random:uniform(100)),
+ async_replicate(Rep);
{error, {'EXIT', {badarg,
[{erlang, apply, [gen_server, start_link, undefined]} | _]}}} ->
% Clause to deal with a change in the supervisor module introduced