From 7dd22ebc2ef139b744c0588f5dfe1d31b99ac7e0 Mon Sep 17 00:00:00 2001 From: Parker Selbert Date: Wed, 25 Oct 2023 20:38:37 -0400 Subject: [PATCH] Start Peer and Stager after queue supervisor The queue supervisor blocks shutdown to give jobs time to shut down gracefully. During that time, the Peer could obtain or retain leadership despite all of the plugins having stopped. Now the Peer and Stager (which is only active on the leader) stop before the queue supervisor. --- lib/oban.ex | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/oban.ex b/lib/oban.ex index 59d69045..def19dd0 100644 --- a/lib/oban.ex +++ b/lib/oban.ex @@ -400,10 +400,10 @@ defmodule Oban do def init(%Config{plugins: plugins} = conf) do children = [ {Notifier, conf: conf, name: Registry.via(conf.name, Notifier)}, - {Peer, conf: conf, name: Registry.via(conf.name, Peer)}, - {Stager, conf: conf, name: Registry.via(conf.name, Stager)}, {DynamicSupervisor, name: Registry.via(conf.name, Foreman), strategy: :one_for_one}, - {Midwife, conf: conf, name: Registry.via(conf.name, Midwife)} + {Peer, conf: conf, name: Registry.via(conf.name, Peer)}, + {Midwife, conf: conf, name: Registry.via(conf.name, Midwife)}, + {Stager, conf: conf, name: Registry.via(conf.name, Stager)} ] children = children ++ Enum.map(plugins, &plugin_child_spec(&1, conf))