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

Allow configuration for default priority #893

Closed
eprothro opened this issue Apr 25, 2023 · 4 comments
Closed

Allow configuration for default priority #893

eprothro opened this issue Apr 25, 2023 · 4 comments
Labels
area:oss Related to Oban OSS closed:wontfix This will not be worked on kind:enhancement New feature or request

Comments

@eprothro
Copy link
Contributor

eprothro commented Apr 25, 2023

Is your feature request related to a problem? Please describe.

High priority jobs (e.g. a heartbeat job) can't be easily elevated above other default priority jobs, as the default priority is the highest priority allowed.

Describe the Solution You'd Like

Allow global configuration for the default priority of a job (currently 0).

Describe Alternatives You've Considered

Explicitly setting priority for every oban job, using application configuration to set to this to a default value.

Other context

We'd like to run with job priorities aligning to high, normal, low, and background, with a default of normal.

@sorentwo
Copy link
Member

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

alter table("oban_jobs") do
  modify :priority, :integer, default: 1
end

Alternatively, you could set a compile time value in your application and reference it in each worker. Oban doesn't define any global values and worker definitions live entirely in your application.

@sorentwo sorentwo added kind:enhancement New feature or request closed:wontfix This will not be worked on area:oss Related to Oban OSS labels Apr 25, 2023
@sorentwo sorentwo closed this as not planned Won't fix, can't repro, duplicate, stale Apr 25, 2023
@eprothro
Copy link
Contributor Author

perfect, thank you!

@eprothro
Copy link
Contributor Author

eprothro commented May 1, 2023

While implementing, realized that the Oban.Job schema defines a default value of 0 for priority.

So, we don't have a way to globally set the default to 1 without modifying the code of every worker.

Can this Ecto schema default be removed since the DB schema defines a default?

@sorentwo
Copy link
Member

sorentwo commented May 1, 2023

Yes, the schema default can be removed. A PR is welcome!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:oss Related to Oban OSS closed:wontfix This will not be worked on kind:enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants