@@ -756,20 +756,20 @@ handle_info({update_user_state, User}, State = #ch{cfg = Cfg}) ->
756
756
noreply (State # ch {cfg = Cfg # conf {user = User }}).
757
757
758
758
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}.
773
773
774
774
terminate (_Reason ,
775
775
State = # ch {cfg = # conf {user = # user {username = Username }},
@@ -2654,20 +2654,20 @@ init_tick_timer(State) ->
2654
2654
reset_tick_timer (State ) ->
2655
2655
State # ch {tick_timer = undefined }.
2656
2656
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.
2671
2671
2672
2672
now_millis () ->
2673
2673
erlang :monotonic_time (millisecond ).
0 commit comments