Skip to content

Commit f3a4e04

Browse files
committed
Don't create shovel if already exists with old sup id
Before 3.13.0 and 3.12.8 supervisor id format was different. Don't start a shovel with the new id format if one exists with the old id format.
1 parent c0d5153 commit f3a4e04

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

deps/rabbitmq_shovel/src/rabbit_shovel_dyn_worker_sup_sup.erl

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,16 +41,18 @@ start_child({VHost, ShovelName} = Name, Def) ->
4141
LockId = rabbit_shovel_locks:lock(Name),
4242
cleanup_specs(),
4343
rabbit_log_shovel:debug("Starting a mirrored supervisor named '~ts' in virtual host '~ts'", [ShovelName, VHost]),
44-
Result = case mirrored_supervisor:start_child(
44+
case child_exists(Name)
45+
orelse mirrored_supervisor:start_child(
4546
?SUPERVISOR,
4647
{id(Name), {rabbit_shovel_dyn_worker_sup, start_link, [Name, obfuscated_uris_parameters(Def)]},
4748
transient, ?WORKER_WAIT, worker, [rabbit_shovel_dyn_worker_sup]}) of
49+
true -> ok;
4850
{ok, _Pid} -> ok;
4951
{error, {already_started, _Pid}} -> ok
5052
end,
5153
%% release the lock if we managed to acquire one
5254
rabbit_shovel_locks:unlock(LockId),
53-
Result.
55+
ok.
5456

5557
obfuscated_uris_parameters(Def) when is_map(Def) ->
5658
to_map(rabbit_shovel_parameters:obfuscate_uris_in_definition(to_list(Def)));

0 commit comments

Comments
 (0)