Skip to content

Commit

Permalink
Start Peer and Stager after queue supervisor
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
sorentwo committed Oct 26, 2023
1 parent e1a60fd commit 7dd22eb
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lib/oban.ex
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down

0 comments on commit 7dd22eb

Please sign in to comment.