Permalink
Browse files

Using a more sane strategy for agent spawn retries.

  • Loading branch information...
1 parent dbab63e commit 75885b2cfe046c2bac669f1572b1cc8190da4af4 @lordnull lordnull committed May 21, 2012
Showing with 2 additions and 13 deletions.
  1. +2 −13 src/dummy_callcenter.erl
View
@@ -221,6 +221,7 @@ set_option(Option, Value) ->
%% Function: init(Args) -> {ok, State} |
%%--------------------------------------------------------------------
init(Options) ->
+ ?INFO("Starting with options: ~p", [Options]),
process_flag(trap_exit, true),
crypto:start(),
Protoconf = #conf{
@@ -369,19 +370,7 @@ handle_info(spawn_agent, #state{conf = Conf} = State) ->
{noreply, State#state{agent_pids = Newagentlist, agent_names = Newnames}};
OrElse ->
?NOTICE("Retrying a failed agent start ~p due to ~p", [Headname, OrElse]),
- PollFun = fun(Looper) ->
- case agent_manager:query_agent(Headname) of
- false ->
- callcenter ! spawn_agent;
- {ok, _} ->
- receive
- after 500 ->
- Looper()
- end
- end
- end,
- DoPoll = fun() -> PollFun(PollFun) end,
- proc_lib:spawn(DoPoll),
+ erlang:send_after(500, callcenter, spawn_agent),
{noreply, State}
end;
{_X, _Y} ->

0 comments on commit 75885b2

Please sign in to comment.