Skip to content

Commit

Permalink
rabbit_shovel_dyn_worker_sup_sup: sync with main
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelklishin committed Oct 26, 2023
1 parent 7ecd751 commit ccc22cb
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions deps/rabbitmq_shovel/src/rabbit_shovel_dyn_worker_sup_sup.erl
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ start_child({VHost, ShovelName} = Name, Def) ->
rabbit_log_shovel:debug("Starting a mirrored supervisor named '~ts' in virtual host '~ts'", [ShovelName, VHost]),
Result = case mirrored_supervisor:start_child(
?SUPERVISOR,
{Name, {rabbit_shovel_dyn_worker_sup, start_link, [Name, obfuscated_uris_parameters(Def)]},
{id(Name), {rabbit_shovel_dyn_worker_sup, start_link, [Name, obfuscated_uris_parameters(Def)]},
transient, ?WORKER_WAIT, worker, [rabbit_shovel_dyn_worker_sup]}) of
{ok, _Pid} -> ok;
{error, {already_started, _Pid}} -> ok
Expand All @@ -58,7 +58,7 @@ obfuscated_uris_parameters(Def) when is_list(Def) ->
rabbit_shovel_parameters:obfuscate_uris_in_definition(Def).

child_exists(Name) ->
lists:any(fun ({N, _, _, _}) -> N =:= Name end,
lists:any(fun ({{_, N}, _, _, _}) -> N =:= Name end,
mirrored_supervisor:which_children(?SUPERVISOR)).

stop_child({VHost, ShovelName} = Name) ->
Expand All @@ -67,8 +67,8 @@ stop_child({VHost, ShovelName} = Name) ->
case get({shovel_worker_autodelete, Name}) of
true -> ok; %% [1]
_ ->
ok = mirrored_supervisor:terminate_child(?SUPERVISOR, Name),
ok = mirrored_supervisor:delete_child(?SUPERVISOR, Name),
ok = mirrored_supervisor:terminate_child(?SUPERVISOR, id(Name)),
ok = mirrored_supervisor:delete_child(?SUPERVISOR, id(Name)),
rabbit_shovel_status:remove(Name)
end,
rabbit_shovel_locks:unlock(LockId),
Expand Down Expand Up @@ -98,4 +98,4 @@ init([]) ->
{ok, {{one_for_one, 3, 10}, []}}.

id({V, S} = Name) ->
{[V, S], Name}.
{[V, S], Name}.

0 comments on commit ccc22cb

Please sign in to comment.