Handle {gen_event_EXIT,{config_listener,ioq},shutdown} message
diff --git a/src/ioq.erl b/src/ioq.erl
index 4598c37..6c01b9c 100644
--- a/src/ioq.erl
+++ b/src/ioq.erl
@@ -75,7 +75,6 @@
false ->
{noreply, State, 0}
end;
-
handle_info({'DOWN', Ref, _, _, Reason}, State) ->
case lists:keytake(Ref, #request.ref, State#state.running) of
{value, Request, Remaining} ->
@@ -84,7 +83,12 @@
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)}.