Skip to content
This repository has been archived by the owner. It is now read-only.
Permalink
Browse files
Merge remote-tracking branch 'iilyak/2561-make-config-API-consistent'
This closes #1

COUCHDB-2561
  • Loading branch information
kxepal committed Feb 4, 2015
2 parents 4c1a1c5 + 6005dc3 commit ff2fccdf584d057bb2963b02cc15209fd8c2fd61
Showing 1 changed file with 10 additions and 3 deletions.
@@ -22,14 +22,16 @@
-behaviour(supervisor).
-behaviour(config_listener).

-vsn(1).

-export([
start_link/0,
init/1
]).

-export([
handle_config_change/5
handle_config_change/5,
handle_config_terminate/3
]).


@@ -54,13 +56,18 @@ 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(_, stop, _) -> ok;
handle_config_terminate(_, _, _) ->
spawn(fun() ->
timer:sleep(5000),
config:listen_for_changes(?MODULE, nil)
end),
ok.

child(Id, Arg) ->
{

0 comments on commit ff2fccd

Please sign in to comment.