Return-Path: X-Original-To: apmail-couchdb-commits-archive@www.apache.org Delivered-To: apmail-couchdb-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 898C51125C for ; Tue, 12 Aug 2014 20:14:55 +0000 (UTC) Received: (qmail 64005 invoked by uid 500); 12 Aug 2014 20:14:55 -0000 Delivered-To: apmail-couchdb-commits-archive@couchdb.apache.org Received: (qmail 63954 invoked by uid 500); 12 Aug 2014 20:14:55 -0000 Mailing-List: contact commits-help@couchdb.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@couchdb.apache.org Delivered-To: mailing list commits@couchdb.apache.org Received: (qmail 63945 invoked by uid 99); 12 Aug 2014 20:14:55 -0000 Received: from tyr.zones.apache.org (HELO tyr.zones.apache.org) (140.211.11.114) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 12 Aug 2014 20:14:55 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id 35342921E54; Tue, 12 Aug 2014 20:14:55 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: davisp@apache.org To: commits@couchdb.apache.org Message-Id: <3eba3aa5c5ea4b45a71a39e9de4a7063@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: couch-replicator commit: updated refs/heads/windsor-merge to 5204eef Date: Tue, 12 Aug 2014 20:14:55 +0000 (UTC) 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 Authored: Tue Aug 12 15:12:57 2014 -0500 Committer: Paul J. Davis 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}