Skip to content

Commit

Permalink
Add :oban_draining to process dict while draining
Browse files Browse the repository at this point in the history
The flag marks the test process while draining to give hints to the
executor and engines.
  • Loading branch information
sorentwo committed Apr 8, 2024
1 parent 2fbf4e2 commit cfe677f
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions lib/oban/queue/drainer.ex
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ defmodule Oban.Queue.Drainer do
@infinite 100_000_000

def drain(%Config{} = conf, [_ | _] = opts) do
Process.put(:oban_draining, true)

args =
opts
|> Map.new()
Expand All @@ -19,6 +21,8 @@ defmodule Oban.Queue.Drainer do
|> Map.update!(:queue, &to_string/1)

drain(conf, %{cancelled: 0, discard: 0, failure: 0, snoozed: 0, success: 0}, args)
after
Process.delete(:oban_draining)
end

defp stage_scheduled(conf, queue, with_scheduled) do
Expand Down

0 comments on commit cfe677f

Please sign in to comment.