Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove default priority from ecto schema #897

Merged
merged 1 commit into from
May 1, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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