michallepicki

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

sorentwo

Oban Core Team

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

mudasobwa

Creator of Cure

I would have started the dynamic supervisor in the main tree and add Oban as its only child after the condition passes.

LostKobrakai

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.

Where Next?

Popular in Questions Top

electic
Hi, I am new to Elixir. I am trying to use the DateTime component to insert a date into MySQL however the there seems to be no way to fo...
New
baxterw3b
Hi guys, i’m new in the Elixir world, and i have to say, that i love it! i’m having some problem to understand anonymous functions with ...
New
jononomo
I am trying to figure out how Mix knows whether the environment is test, dev, or prod – where is this set? Thanks.
New
New
vonH
When I run the Plug and I recompile I wind up having to use Ctrl C to quit iex and start again. Witht the help of rlwrap I can use the cu...
New
Fl4m3Ph03n1x
About me? ( if you have nothing better to do than reading about some random guy in the internet :stuck_out_tongue: ) Hello all, this is ...
New
belgoros
I’m not a pro in using Regex and can’t figure out why the following behaviour happens, especially if we take into account the difference ...
New

Other popular topics Top

New
vonH
When I run the Plug and I recompile I wind up having to use Ctrl C to quit iex and start again. Witht the help of rlwrap I can use the cu...
New
ashish173
I am using Ecto timestamps with postgres, I can see the timestamps() use the :naive_dateime but for my use case I wanted to store the ti...
New
nsuchy
Hi. I’ve noticed that Windows Powershell has it’s own IEX command and you cannot access Elixir’s IEX due to the conflict. This isn’t a cr...
New
aadeshere1
I have a another noob question about loop. Since elixir is immutable, while loop is not directly possible. total = 10 while total != 0 ...
New
JorisKok
I have a server on AWS, and was running a load test using artillery. When looking at the Phoenix dashboard I see the Ports going to 100% ...
New

We're in Beta

About us Mission Statement