summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorILYA Khlopotov <iilyak@ca.ibm.com>2015-01-30 10:59:43 -0800
committerILYA Khlopotov <iilyak@ca.ibm.com>2015-01-30 10:59:43 -0800
commitad60d329a038d2b1aa5ee083f22b1ee7906ec31d (patch)
tree4b875f11e128ac472e5f18b714d8fc40eb82fcb8
parent217503577e23f26dfd2f9cbaa52e9f78aaa3b308 (diff)
downloadcouchdb-ad60d329a038d2b1aa5ee083f22b1ee7906ec31d.tar.gz
Update config_listener behaviuor
COUCHDB-2561
-rw-r--r--src/ioq.erl15
1 files changed, 8 insertions, 7 deletions
diff --git a/src/ioq.erl b/src/ioq.erl
index 6c01b9c60..c4b3b4e30 100644
--- a/src/ioq.erl
+++ b/src/ioq.erl
@@ -18,7 +18,7 @@
-export([init/1, handle_call/3, handle_cast/2, handle_info/2, code_change/3, terminate/2]).
% config_listener api
--export([handle_config_change/5]).
+-export([handle_config_change/5, handle_config_terminate/3]).
-record(state, {
concurrency,
@@ -83,12 +83,6 @@ handle_info({'DOWN', Ref, _, _, Reason}, State) ->
false ->
{noreply, State, 0}
end;
-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, nil),
- {noreply, State};
handle_info(timeout, State) ->
{noreply, maybe_submit_request(State)}.
@@ -97,6 +91,13 @@ handle_config_change("ioq", _, _, _, _) ->
handle_config_change(_, _, _, _, _) ->
{ok, nil}.
+handle_config_terminate(_, _, _) ->
+ spawn(fun() ->
+ timer:sleep(5000),
+ config:listen_for_changes(?MODULE, nil)
+ end),
+ ok.
+
code_change(_Vsn, State, _Extra) ->
{ok, State}.