Repository: couchdb-couch-event Updated Branches: refs/heads/master 835a41885 -> 7e3821322
Update handle_config_terminate API COUCHDB-3102 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/c1e34350 Tree: http://git-wip-us.apache.org/repos/asf/couchdb-couch-event/tree/c1e34350 Diff: http://git-wip-us.apache.org/repos/asf/couchdb-couch-event/diff/c1e34350 Branch: refs/heads/master Commit: c1e343508130a48f2f0867bac37c91176a7d7cf1 Parents: 835a418 Author: ILYA Khlopotov <iil...@ca.ibm.com> Authored: Wed Aug 17 11:45:13 2016 -0700 Committer: ILYA Khlopotov <iil...@ca.ibm.com> Committed: Tue Aug 23 12:24:09 2016 -0700 ---------------------------------------------------------------------- src/couch_event_os_sup.erl | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/couchdb-couch-event/blob/c1e34350/src/couch_event_os_sup.erl ---------------------------------------------------------------------- diff --git a/src/couch_event_os_sup.erl b/src/couch_event_os_sup.erl index ba38f87..f219d00 100644 --- a/src/couch_event_os_sup.erl +++ b/src/couch_event_os_sup.erl @@ -22,7 +22,7 @@ -behaviour(supervisor). -behaviour(config_listener). --vsn(1). +-vsn(2). -export([ start_link/0, @@ -40,10 +40,17 @@ start_link() -> init([]) -> - ok = config:listen_for_changes(?MODULE, nil), - UpdateNotifierExes = config:get("update_notification"), - Children = [child(Id, Exe) || {Id, Exe} <- UpdateNotifierExes], + Children = [ + { + config_listener_mon, + {config_listener_mon, start_link, [?MODULE, nil]}, + permanent, + 5000, + worker, + [config_listener_mon] + } + | [child(Id, Exe) || {Id, Exe} <- UpdateNotifierExes]], {ok, { {one_for_one, 10, 3600}, @@ -61,12 +68,7 @@ handle_config_change("update_notification", Id, Exe, _, _) when is_list(Exe) -> 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), +handle_config_terminate(_Server, _Reason, _State) -> ok. child(Id, Arg) ->