Skip to content

Commit

Permalink
Remove default priority from job schema (#897)
Browse files Browse the repository at this point in the history
  • Loading branch information
eprothro committed May 1, 2023
1 parent 7c07f3a commit 2ec8e17
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 2 deletions.
11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -430,6 +430,17 @@ a job by assigning a numerical `priority`.
priority. Within a particular priority jobs are executed in their scheduled
order.

#### Caveats & Guidelines

The default priority is defined in the jobs table. The least intrusive way to
change it for all jobs is to change the column default:

```elixir
alter table("oban_jobs") do
modify :priority, :integer, default: 1, from: {:integer, default: 0}
end
```

## Unique Jobs

The unique jobs feature lets you specify constraints to prevent enqueueing
Expand Down
2 changes: 1 addition & 1 deletion lib/oban/job.ex
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ defmodule Oban.Job do
field :attempt, :integer, default: 0
field :attempted_by, {:array, :string}
field :max_attempts, :integer, default: 20
field :priority, :integer, default: 0
field :priority, :integer

field :attempted_at, :utc_datetime_usec
field :cancelled_at, :utc_datetime_usec
Expand Down
2 changes: 1 addition & 1 deletion test/oban/job_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ defmodule Oban.JobTest do
end

describe "to_map/1" do
@keys_with_defaults ~w(args attempt errors max_attempts meta priority queue state tags)a
@keys_with_defaults ~w(args attempt errors max_attempts meta queue state tags)a

defp to_keys(opts) do
%{}
Expand Down

0 comments on commit 2ec8e17

Please sign in to comment.