Skip to content

Commit a9417a2

Browse files
committed
issues #16, #20: fix cache supervisor rabbit_boot_step
The cache supervisor boot step was starting the process directly via the `start_link` function. This is error prone as we are not sure about the life-cycle of the bootstrap process. It appeared to work during a proper bootstrap of the broker but was faulty when enabling the plugin on a running one. This patch starts the cache supervisor as a child of the main rabbit supervisor process correctly ensuring its management. Signed-off-by: Matteo Cafasso <[email protected]>
1 parent ca8b27d commit a9417a2

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

lib/supervisor.ex

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,18 +20,15 @@ defmodule RabbitMQ.MessageDeduplicationPlugin.Supervisor do
2020
@rabbit_boot_step {
2121
__MODULE__,
2222
[description: "message deduplication plugin cache supervisor",
23-
mfa: {__MODULE__, :start_link, []},
23+
mfa: {:rabbit_sup, :start_child, [__MODULE__]},
2424
requires: :database,
2525
enables: :external_infrastructure]}
2626

2727
@doc """
2828
Start the Supervisor process.
2929
"""
3030
def start_link() do
31-
case DynamicSupervisor.start_link(__MODULE__, [], name: __MODULE__) do
32-
{:ok, _pid} -> :ok
33-
_ -> :error
34-
end
31+
DynamicSupervisor.start_link(__MODULE__, [], name: __MODULE__)
3532
end
3633

3734
@doc """

0 commit comments

Comments
 (0)