Database connection errors running Oban on Heroku

Your initial issue was likely due to the single connection being held by your job while oban tries to fetch more jobs or record heartbeats.

That’s correct. Oban uses one additional connection for pubsub notifications.

I typically use something like this in application.ex to prevent jobs running in an iex session:

  defp oban_config do
    opts = Application.get_env(:my_app, Oban)

    if Code.ensure_loaded?(IEx) and IEx.started?() do
      opts
      |> Keyword.put(:crontab, false)
      |> Keyword.put(:queues, false)
    else
      opts
    end
  end
5 Likes