couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kxe...@apache.org
Subject [3/4] couchdb-couch-event git commit: Update config_listener behaviuor
Date Wed, 04 Feb 2015 15:49:44 GMT
Update config_listener behaviuor

COUCHDB-2561


Project: http://git-wip-us.apache.org/repos/asf/couchdb-couch-event/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb-couch-event/commit/71cd331d
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-couch-event/tree/71cd331d
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-couch-event/diff/71cd331d

Branch: refs/heads/master
Commit: 71cd331daf7a0568ff641a06543fa62cc4221fc4
Parents: 06477c2
Author: ILYA Khlopotov <iilyak@ca.ibm.com>
Authored: Thu Jan 29 13:31:24 2015 -0800
Committer: ILYA Khlopotov <iilyak@ca.ibm.com>
Committed: Wed Feb 4 06:06:34 2015 -0800

----------------------------------------------------------------------
 src/couch_event_os_sup.erl | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb-couch-event/blob/71cd331d/src/couch_event_os_sup.erl
----------------------------------------------------------------------
diff --git a/src/couch_event_os_sup.erl b/src/couch_event_os_sup.erl
index fa7e66d..2a1457b 100644
--- a/src/couch_event_os_sup.erl
+++ b/src/couch_event_os_sup.erl
@@ -29,7 +29,8 @@
 ]).
 
 -export([
-    handle_config_change/5
+    handle_config_change/5,
+    handle_config_terminate/3
 ]).
 
 
@@ -54,13 +55,17 @@ handle_config_change("update_notification", Id, deleted, _, _) ->
     supervisor:delete_child(?MODULE, Id),
     {ok, nil};
 handle_config_change("update_notification", Id, Exe, _, _) when is_list(Exe) ->
-    supervisor:terminate_child(?MODULE, Id),
-    supervisor:delete_child(?MODULE, Id),
     supervisor:start_child(?MODULE, child(Id, Exe)),
     {ok, nil};
 handle_config_change(_, _, _, _, _) ->
     {ok, nil}.
 
+handle_config_terminate(_, _, _) ->
+    spawn(fun() ->
+        timer:sleep(5000),
+        config:listen_for_changes(?MODULE, nil)
+    end),
+    ok.
 
 child(Id, Arg) ->
     {


Mime
View raw message