Skip to content

When reacting to a forced event refresh command, emit consumer creation events for all consumers #3078

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jun 2, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 7 additions & 14 deletions deps/rabbit/src/rabbit_amqqueue_process.erl
Original file line number Diff line number Diff line change
Expand Up @@ -1620,23 +1620,16 @@ handle_cast({credit, ChPid, CTag, Credit, Drain},
% This event is necessary for the stats timer to be initialized with
% the correct values once the management agent has started
handle_cast({force_event_refresh, Ref},
State = #q{consumers = Consumers,
active_consumer = Holder}) ->
State = #q{consumers = Consumers}) ->
rabbit_event:notify(queue_created, infos(?CREATION_EVENT_KEYS, State), Ref),
QName = qname(State),
AllConsumers = rabbit_queue_consumers:all(Consumers),
case Holder of
none ->
[emit_consumer_created(
Ch, CTag, false, AckRequired, QName, Prefetch,
Args, Ref, ActingUser) ||
{Ch, CTag, AckRequired, Prefetch, _, _, Args, ActingUser}
<- AllConsumers];
{Ch, CTag} ->
[{Ch, CTag, AckRequired, Prefetch, _, _, Args, ActingUser}] = AllConsumers,
emit_consumer_created(
Ch, CTag, true, AckRequired, QName, Prefetch, Args, Ref, ActingUser)
end,
rabbit_log:debug("Queue ~s forced to re-emit events, consumers: ~p", [rabbit_misc:rs(QName), AllConsumers]),
[emit_consumer_created(
Ch, CTag, ActiveOrExclusive, AckRequired, QName, Prefetch,
Args, Ref, ActingUser) ||
{Ch, CTag, AckRequired, Prefetch, ActiveOrExclusive, _, Args, ActingUser}
<- AllConsumers],
noreply(rabbit_event:init_stats_timer(State, #q.stats_timer));

handle_cast(notify_decorators, State) ->
Expand Down