couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kxe...@apache.org
Subject [3/4] couch-replicator commit: updated refs/heads/master to b1c2cc0
Date Wed, 04 Feb 2015 15:49:41 GMT
Update config_listener behaviuor

COUCHDB-2561


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

Branch: refs/heads/master
Commit: 5007234f9ecb0ce0d5b9a13d4fdf0213a9909760
Parents: 4de038d
Author: ILYA Khlopotov <iilyak@ca.ibm.com>
Authored: Thu Jan 29 13:45:20 2015 -0800
Committer: ILYA Khlopotov <iilyak@ca.ibm.com>
Committed: Wed Feb 4 06:09:50 2015 -0800

----------------------------------------------------------------------
 src/couch_replicator_manager.erl | 17 +++++++----------
 1 file changed, 7 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb-couch-replicator/blob/5007234f/src/couch_replicator_manager.erl
----------------------------------------------------------------------
diff --git a/src/couch_replicator_manager.erl b/src/couch_replicator_manager.erl
index d6c88c1..15b5b57 100644
--- a/src/couch_replicator_manager.erl
+++ b/src/couch_replicator_manager.erl
@@ -12,7 +12,7 @@
 
 -module(couch_replicator_manager).
 -behaviour(gen_server).
--vsn(1).
+-vsn(2).
 -behaviour(config_listener).
 
 % public API
@@ -28,7 +28,7 @@
 -export([changes_reader/3, changes_reader_cb/3]).
 
 % config_listener callback
--export([handle_config_change/5]).
+-export([handle_config_change/5, handle_config_terminate/3]).
 
 -export([handle_db_event/3]).
 
@@ -125,6 +125,11 @@ handle_config_change("replicator", "max_replication_retry_count", V,
_, S) ->
 handle_config_change(_, _, _, _, S) ->
     {ok, S}.
 
+handle_config_terminate(Self, _, _) ->
+    spawn(fun() ->
+        timer:sleep(5000),
+        config:listen_for_changes(?MODULE, Self)
+    end).
 
 init(_) ->
     process_flag(trap_exit, true),
@@ -250,14 +255,6 @@ handle_info({'DOWN', _Ref, _, _, _}, State) ->
     % From a db monitor created by a replication process. Ignore.
     {noreply, State};
 
-handle_info({gen_event_EXIT, {config_listener, ?MODULE}, _Reason}, State) ->
-    erlang:send_after(5000, self(), restart_config_listener),
-    {noreply, State};
-
-handle_info(restart_config_listener, State) ->
-    ok = config:listen_for_changes(?MODULE, self()),
-    {noreply, State};
-
 handle_info(shutdown, State) ->
     {stop, shutdown, State};
 


Mime
View raw message