This commit is contained in:
Feng Lee 2015-08-16 22:01:04 +08:00
parent 11298a9581
commit f9eeab89a2
3 changed files with 9 additions and 3 deletions

View File

@ -122,5 +122,5 @@ dispatch(Topic, CPid) when is_binary(Topic) ->
end, end,
mnesia:async_dirty(fun mnesia:foldl/3, [Fun, [], retained]) mnesia:async_dirty(fun mnesia:foldl/3, [Fun, [], retained])
end, end,
[CPid ! {dispatch, Msg} || Msg <- Msgs]. lists:foreach(fun(Msg) -> CPid ! {dispatch, Msg} end, lists:reverse(Msgs)).

View File

@ -268,6 +268,7 @@ prioritise_info(Msg, _Len, _State) ->
session_expired -> 10; session_expired -> 10;
{timeout, _, _} -> 5; {timeout, _, _} -> 5;
collect_info -> 2; collect_info -> 2;
{dispatch, _} -> 1;
_ -> 0 _ -> 0
end. end.

View File

@ -633,8 +633,13 @@ extend_backoff({backoff, InitialTimeout, MinimumTimeout, DesiredHibPeriod}) ->
%%% The MAIN loop. %%% The MAIN loop.
%%% --------------------------------------------------- %%% ---------------------------------------------------
loop(GS2State = #gs2_state { time = hibernate, loop(GS2State = #gs2_state { time = hibernate,
timeout_state = undefined }) -> timeout_state = undefined,
pre_hibernate(GS2State); queue = Queue }) ->
case priority_queue:is_empty(Queue) of
true -> pre_hibernate(GS2State);
false -> process_next_msg(GS2State)
end;
loop(GS2State) -> loop(GS2State) ->
process_next_msg(drain(GS2State)). process_next_msg(drain(GS2State)).