@@ -745,20 +745,20 @@ handle_info({update_user_state, User}, State = #ch{cfg = Cfg}) ->
745
745
noreply (State # ch {cfg = Cfg # conf {user = User }}).
746
746
747
747
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}.
762
762
763
763
terminate (_Reason ,
764
764
State = # ch {cfg = # conf {user = # user {username = Username }},
@@ -2640,20 +2640,20 @@ init_tick_timer(State) ->
2640
2640
reset_tick_timer (State ) ->
2641
2641
State # ch {tick_timer = undefined }.
2642
2642
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.
2657
2657
2658
2658
now_millis () ->
2659
2659
erlang :monotonic_time (millisecond ).
0 commit comments