fix gen_server2 issue, https://github.com/rabbitmq/rabbitmq-server/issues/268
This commit is contained in:
parent
11298a9581
commit
f9eeab89a2
|
@ -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)).
|
||||||
|
|
||||||
|
|
|
@ -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.
|
||||||
|
|
||||||
|
|
|
@ -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)).
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue