couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dav...@apache.org
Subject couch-replicator commit: updated refs/heads/windsor-merge to 5204eef
Date Tue, 12 Aug 2014 20:14:55 GMT
Repository: couchdb-couch-replicator
Updated Branches:
  refs/heads/windsor-merge 9640ccf2e -> 5204eef58


Update replication tasks once a second

If a replication finishes in less than a second and then sits idle it
won't get around to updating its task status until the next event. This
change just triggers an update once a second regardless of change.

This was biting us in the replication tasks where we were wasting a lot
of time sleeping waiting for replications to finish.


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/5204eef5
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-couch-replicator/tree/5204eef5
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-couch-replicator/diff/5204eef5

Branch: refs/heads/windsor-merge
Commit: 5204eef584b63221daedf29c2a39b7370ddc62f1
Parents: 9640ccf
Author: Paul J. Davis <paul.joseph.davis@gmail.com>
Authored: Tue Aug 12 15:12:57 2014 -0500
Committer: Paul J. Davis <paul.joseph.davis@gmail.com>
Committed: Tue Aug 12 15:14:03 2014 -0500

----------------------------------------------------------------------
 src/couch_replicator.erl | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb-couch-replicator/blob/5204eef5/src/couch_replicator.erl
----------------------------------------------------------------------
diff --git a/src/couch_replicator.erl b/src/couch_replicator.erl
index 0c06145..e5bf90c 100644
--- a/src/couch_replicator.erl
+++ b/src/couch_replicator.erl
@@ -233,7 +233,6 @@ init(InitArgs) ->
 
 do_init(#rep{options = Options, id = {BaseId, Ext}, user_ctx=UserCtx} = Rep) ->
     process_flag(trap_exit, true),
-
     #rep_state{
         source = Source,
         target = Target,
@@ -290,6 +289,7 @@ do_init(#rep{options = Options, id = {BaseId, Ext}, user_ctx=UserCtx}
= Rep) ->
         {checkpoint_interval, CheckpointInterval}
     ]),
     couch_task_status:set_update_frequency(1000),
+    erlang:send_after(1100, self(), update_task),
 
     % Until OTP R14B03:
     %
@@ -389,6 +389,11 @@ handle_info({'EXIT', Pid, Reason}, #rep_state{workers = Workers} = State)
->
         {stop, {worker_died, Pid, Reason}, State2}
     end;
 
+handle_info(update_task, State) ->
+    erlang:send_after(1100, self(), update_task),
+    update_task(State),
+    {noreply, State};
+
 handle_info(timeout, InitArgs) ->
     try do_init(InitArgs) of {ok, State} ->
         {noreply, State}


Mime
View raw message