michallepicki
How to start Oban, but delay job processing?
I am using Oban and occasionally, shortly after a deployment, a handful of jobs can fail because of dependency on other parts of the system that is not yet started. I think I cannot re-order the entries in my supervision tree to avoid the problem, because that dependency also relies on Oban to be functional. So it’s a chicken-and-egg problem.
What is the best way to start Oban and have it running without executing any jobs, and only start job processing after some condition passes? An LLM suggested configuring queues to be in the paused state by default, and adding a one-shot supervised child that calls Oban.resume_all_queues(local_only: true) later in the supervision tree
Most Liked
sorentwo
The LLM is correct, and likely referencing previous advice we’ve given on this exact topic. This is the exact situation that drove being able to start jobs in a paused state.
Ideally you would have Oban be one of the last dependencies to start to avoid this problem, but that’s not always possible.
That’s not correct, you need Oban started to insert jobs. It doesn’t need to run any queues or plugins, but an instance must be registered.
It is possible to build a raw job changeset and insert it through a repo call, but you’ll loose a lot of functionality and configuration.
mudasobwa
I would have started the dynamic supervisor in the main tree and add Oban as its only child after the condition passes.
LostKobrakai
What is that dependency on Oban? To write new jobs? Afaik writing jobs just needs the repo to be up, but none of the Oban processes being started.
Popular in Questions
Other popular topics
Latest Oban Threads
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #deployment
- #library
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #channels
- #elixirconf
- #exunit
- #discussion
- #code-sync
- #javascript
- #podcasts
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixir-ls
- #phoenix_html
- #iex
- #blog-post
- #graphql
- #genstage
- #ai
- #websockets
- #supervisor
- #elixirconf-us
- #advent-of-code
- #distillery
- #processes
- #forms
- #api
- #metaprogramming
- #security
- #hex










