Skip to content

Commit

Permalink
Restore zero arity version of pause_all_queues/0
Browse files Browse the repository at this point in the history
Both pause and resume variants lost their default argument in a refactor
that shifted around guard clauses.
  • Loading branch information
sorentwo committed Apr 17, 2024
1 parent b66ee14 commit d173011
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
2 changes: 2 additions & 0 deletions lib/oban.ex
Original file line number Diff line number Diff line change
Expand Up @@ -921,6 +921,7 @@ defmodule Oban do
end

@doc false
def pause_all_queues(name \\ Oban)
def pause_all_queues(opts) when is_list(opts), do: pause_all_queues(__MODULE__, opts)
def pause_all_queues(name), do: pause_all_queues(name, [])

Expand Down Expand Up @@ -995,6 +996,7 @@ defmodule Oban do
end

@doc false
def resume_all_queues(name \\ Oban)
def resume_all_queues(opts) when is_list(opts), do: resume_all_queues(__MODULE__, opts)
def resume_all_queues(name), do: resume_all_queues(name, [])

Expand Down
12 changes: 12 additions & 0 deletions test/support/exercise.ex
Original file line number Diff line number Diff line change
Expand Up @@ -44,5 +44,17 @@ defmodule Oban.Test.Exercise do
%Multi{} = Oban.insert_all(Oban, Multi.new(), :job, [changeset], timeout: 500)
end

def check_pause_resume_all do
Oban.pause_all_queues()
Oban.pause_all_queues(Oban)
Oban.pause_all_queues(Oban, local_only: true)
Oban.pause_all_queues(local_only: true)

Oban.resume_all_queues()
Oban.resume_all_queues(Oban)
Oban.resume_all_queues(Oban, local_only: true)
Oban.resume_all_queues(local_only: true)
end

defp changeset, do: Job.new(%{}, worker: "FakeWorker")
end

0 comments on commit d173011

Please sign in to comment.