@@ -756,20 +756,20 @@ handle_info({update_user_state, User}, State = #ch{cfg = Cfg}) ->
756756 noreply (State # ch {cfg = Cfg # conf {user = User }}).
757757
758758
759- handle_pre_hibernate (State0 ) ->
760- ok = clear_permission_cache (),
761- State = maybe_cancel_tick_timer (State0 ),
762- rabbit_event :if_enabled (
763- State , # ch .stats_timer ,
764- fun () -> emit_stats (State ,
765- [{idle_since ,
766- os :system_time (millisecond )}])
767- end ),
768- {hibernate , rabbit_event :stop_stats_timer (State , # ch .stats_timer )}.
769-
770- handle_post_hibernate (State0 ) ->
771- State = init_tick_timer (State0 ),
772- {noreply , State }.
759+ % handle_pre_hibernate(State0) ->
760+ % ok = clear_permission_cache(),
761+ % State = maybe_cancel_tick_timer(State0),
762+ % rabbit_event:if_enabled(
763+ % State, #ch.stats_timer,
764+ % fun () -> emit_stats(State,
765+ % [{idle_since,
766+ % os:system_time(millisecond)}])
767+ % end),
768+ % {hibernate, rabbit_event:stop_stats_timer(State, #ch.stats_timer)}.
769+ %
770+ % handle_post_hibernate(State0) ->
771+ % State = init_tick_timer(State0),
772+ % {noreply, State}.
773773
774774terminate (_Reason ,
775775 State = # ch {cfg = # conf {user = # user {username = Username }},
@@ -2654,20 +2654,20 @@ init_tick_timer(State) ->
26542654reset_tick_timer (State ) ->
26552655 State # ch {tick_timer = undefined }.
26562656
2657- maybe_cancel_tick_timer (# ch {tick_timer = undefined } = State ) ->
2658- State ;
2659- maybe_cancel_tick_timer (# ch {tick_timer = TRef ,
2660- unacked_message_q = UMQ } = State ) ->
2661- case ? QUEUE :len (UMQ ) of
2662- 0 ->
2663- % % we can only cancel the tick timer if the unacked messages
2664- % % queue is empty.
2665- _ = erlang :cancel_timer (TRef ),
2666- State # ch {tick_timer = undefined };
2667- _ ->
2668- % % let the timer continue
2669- State
2670- end .
2657+ % maybe_cancel_tick_timer(#ch{tick_timer = undefined} = State) ->
2658+ % State;
2659+ % maybe_cancel_tick_timer(#ch{tick_timer = TRef,
2660+ % unacked_message_q = UMQ} = State) ->
2661+ % case ?QUEUE:len(UMQ) of
2662+ % 0 ->
2663+ % %% we can only cancel the tick timer if the unacked messages
2664+ % %% queue is empty.
2665+ % _ = erlang:cancel_timer(TRef),
2666+ % State#ch{tick_timer = undefined};
2667+ % _ ->
2668+ % %% let the timer continue
2669+ % State
2670+ % end.
26712671
26722672now_millis () ->
26732673 erlang :monotonic_time (millisecond ).
0 commit comments