Merge remote-tracking branch 'iilyak/2561-make-config-API-consistent'
This closes #1
COUCHDB-2561
diff --git a/src/couch_event_os_sup.erl b/src/couch_event_os_sup.erl
index fa7e66d..ba38f87 100644
--- a/src/couch_event_os_sup.erl
+++ b/src/couch_event_os_sup.erl
@@ -22,6 +22,7 @@
-behaviour(supervisor).
-behaviour(config_listener).
+-vsn(1).
-export([
start_link/0,
@@ -29,7 +30,8 @@
]).
-export([
- handle_config_change/5
+ handle_config_change/5,
+ handle_config_terminate/3
]).
@@ -54,13 +56,18 @@
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(_, stop, _) -> ok;
+handle_config_terminate(_, _, _) ->
+ spawn(fun() ->
+ timer:sleep(5000),
+ config:listen_for_changes(?MODULE, nil)
+ end),
+ ok.
child(Id, Arg) ->
{