Skip to main content

Parker Selbert

sorentwo

sorentwo

Oban - Graceful Shutdown

Did you know that when an app shuts down Oban pauses all queues and waits for jobs to finish? The time is configurable and defaults to 15 seconds, short enough for most deployments. https://hexdocs.pm/oban/Oban.html#start_link/1-twiddly-options
# Change the default to 30 seconds
config :my_app, Oban,
  repo: MyApp.Repo,
  queues: [default: 10]
  shutdown_grace_period: :timer.seconds(30)

# Wait up to an hour for long running jobs in a blue-green style deply
config :my_app, Oban,
  shutdown_grace_period: :timer.minutes(60)
20 upvotes

© 2021 Zest Creative, LLC