Pause Oban Pro Workflow?

As alluded earlier in this thread, the way we usually suggest doing this is to have the job you’d like to pause snooze itself in a loop, with a limit to prevent unbounded retries. Here’s an example:

defmodule MyApp.PausedWorker do
  use Oban.Pro.Worker

  @impl Oban.Pro.Worker
  def process(job) do
    if some_external_event(job.args) do
      # do something here
    else
      {:snooze, 60}
    end
  end
end

You can optionally use unique and replace to upsert the snoozing job to run immediately, but it requires carefully setting the workflow_id:

  use Oban.Pro.Worker,
    unique: [meta: [:workflow_id, :name]],
    replace: [scheduled: [:scheduled_at]]

This question comes up rather frequently though, and a proper Oban.Pro.Workflow.pause/1 and Oban.Pro.Workflow.resume/1 seem warranted :thinking: