Oban - it is posibble to stop / disable jobs at runtime

Hi,

I have an Elixir application configured to run background scheduled jobs.
One of them runs every couple of minutes and fails every time.
I’d like to disable this particular job.

Is there any way to do it ?

Cheers

You could simply delete the job from the oban_jobs table, or connect remotely to your app’s iex console and cancel_job/2.

1 Like

Hi @sfusato,

Thank you very much for your quick reply.

This job is configured to run hourly in config.exs.

This table contains more than 300 entries for the job I’m targeting.
And all are in state retryable.
So it seems there is an entry per execution of this job and that most if not all have failed.

My need is to prevent the scheduled job from being executed again.

Is it possible ?

Cheers

Don’t enqueue it anymore, which is to say remove it from code until you fix the reason of why it’s failing (if it’s not supposed to) or limit the retries ("By default, jobs are retried up to 20 times. ").

1 Like

Ok, I was hopping I could stop that without rebuilding and redeploying the app, as a workaround, until I fix the root cause of failure.