Skip to content

Commit

Permalink
Clear #st.info_f _outside_ of the info function
Browse files Browse the repository at this point in the history
  • Loading branch information
uwiger committed Dec 17, 2012
1 parent 988f4d6 commit a7def1a
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions src/jobs_server.erl
Original file line number Diff line number Diff line change
Expand Up @@ -547,11 +547,12 @@ interval(Limit) ->
1000 / Limit.

set_info(S) ->
S#st{info_f = fun(Q) ->
%% We need to clear the info_f attribute, to
%% avoid recursively inheriting all previous states.
get_info(Q, S#st{info_f = undefined})
end}.
%% We need to clear the info_f attribute, to
%% avoid recursively inheriting all previous states.
S1 = S#st{info_f = undefined},
S1#st{info_f = fun(Q) ->
get_info(Q, S1)
end}.


%% Gen_server callbacks
Expand Down Expand Up @@ -785,7 +786,7 @@ terminate(_,_) ->
ok.

code_change(_FromVsn, St, _Extra) ->
{ok, St}.
{ok, set_info(St)}.


%% Internal functions
Expand Down

0 comments on commit a7def1a

Please sign in to comment.