Skip to content

Commit

Permalink
WIP: pre/post_hibernate
Browse files Browse the repository at this point in the history
  • Loading branch information
mkuratczyk committed Sep 5, 2024
1 parent 5a86545 commit 5cfbb9f
Showing 1 changed file with 14 additions and 14 deletions.
28 changes: 14 additions & 14 deletions deps/rabbit/src/rabbit_channel.erl
Original file line number Diff line number Diff line change
Expand Up @@ -745,20 +745,20 @@ handle_info({update_user_state, User}, State = #ch{cfg = Cfg}) ->
noreply(State#ch{cfg = Cfg#conf{user = User}}).


handle_pre_hibernate(State0) ->
ok = clear_permission_cache(),
State = maybe_cancel_tick_timer(State0),
rabbit_event:if_enabled(
State, #ch.stats_timer,
fun () -> emit_stats(State,
[{idle_since,
os:system_time(millisecond)}])
end),
{hibernate, rabbit_event:stop_stats_timer(State, #ch.stats_timer)}.

handle_post_hibernate(State0) ->
State = init_tick_timer(State0),
{noreply, State}.
%handle_pre_hibernate(State0) ->
% ok = clear_permission_cache(),
% State = maybe_cancel_tick_timer(State0),
% rabbit_event:if_enabled(
% State, #ch.stats_timer,
% fun () -> emit_stats(State,
% [{idle_since,
% os:system_time(millisecond)}])
% end),
% {hibernate, rabbit_event:stop_stats_timer(State, #ch.stats_timer)}.
%
%handle_post_hibernate(State0) ->
% State = init_tick_timer(State0),
% {noreply, State}.

terminate(_Reason,
State = #ch{cfg = #conf{user = #user{username = Username}},
Expand Down

0 comments on commit 5cfbb9f

Please sign in to comment.