@@ -745,20 +745,20 @@ handle_info({update_user_state, User}, State = #ch{cfg = Cfg}) ->
745745 noreply (State # ch {cfg = Cfg # conf {user = User }}).
746746
747747
748- handle_pre_hibernate (State0 ) ->
749- ok = clear_permission_cache (),
750- State = maybe_cancel_tick_timer (State0 ),
751- rabbit_event :if_enabled (
752- State , # ch .stats_timer ,
753- fun () -> emit_stats (State ,
754- [{idle_since ,
755- os :system_time (millisecond )}])
756- end ),
757- {hibernate , rabbit_event :stop_stats_timer (State , # ch .stats_timer )}.
758-
759- handle_post_hibernate (State0 ) ->
760- State = init_tick_timer (State0 ),
761- {noreply , State }.
748+ % handle_pre_hibernate(State0) ->
749+ % ok = clear_permission_cache(),
750+ % State = maybe_cancel_tick_timer(State0),
751+ % rabbit_event:if_enabled(
752+ % State, #ch.stats_timer,
753+ % fun () -> emit_stats(State,
754+ % [{idle_since,
755+ % os:system_time(millisecond)}])
756+ % end),
757+ % {hibernate, rabbit_event:stop_stats_timer(State, #ch.stats_timer)}.
758+ %
759+ % handle_post_hibernate(State0) ->
760+ % State = init_tick_timer(State0),
761+ % {noreply, State}.
762762
763763terminate (_Reason ,
764764 State = # ch {cfg = # conf {user = # user {username = Username }},
@@ -2640,20 +2640,20 @@ init_tick_timer(State) ->
26402640reset_tick_timer (State ) ->
26412641 State # ch {tick_timer = undefined }.
26422642
2643- maybe_cancel_tick_timer (# ch {tick_timer = undefined } = State ) ->
2644- State ;
2645- maybe_cancel_tick_timer (# ch {tick_timer = TRef ,
2646- unacked_message_q = UMQ } = State ) ->
2647- case ? QUEUE :len (UMQ ) of
2648- 0 ->
2649- % % we can only cancel the tick timer if the unacked messages
2650- % % queue is empty.
2651- _ = erlang :cancel_timer (TRef ),
2652- State # ch {tick_timer = undefined };
2653- _ ->
2654- % % let the timer continue
2655- State
2656- end .
2643+ % maybe_cancel_tick_timer(#ch{tick_timer = undefined} = State) ->
2644+ % State;
2645+ % maybe_cancel_tick_timer(#ch{tick_timer = TRef,
2646+ % unacked_message_q = UMQ} = State) ->
2647+ % case ?QUEUE:len(UMQ) of
2648+ % 0 ->
2649+ % %% we can only cancel the tick timer if the unacked messages
2650+ % %% queue is empty.
2651+ % _ = erlang:cancel_timer(TRef),
2652+ % State#ch{tick_timer = undefined};
2653+ % _ ->
2654+ % %% let the timer continue
2655+ % State
2656+ % end.
26572657
26582658now_millis () ->
26592659 erlang :monotonic_time (millisecond ).
0 commit comments