Skip to content

fix(ActiveJob): handle explicitly-nil priority - #119

Merged
smudge merged 1 commit into
mainfrom
smudge/stack/2
Aug 7, 2026
Merged

fix(ActiveJob): handle explicitly-nil priority#119
smudge merged 1 commit into
mainfrom
smudge/stack/2

Conversation

@smudge

@smudge smudge commented Aug 4, 2026

Copy link
Copy Markdown
Member

It appears that newer versions of ActiveJob's retry_on always pass priority (nil unless specified) to retry_job, so opts.key?(:priority) coerced nil into 0.

This means that every retry_on retry was silently re-enqueued at priority 0 (unless otherwise specified in the retry_on declaration).

samandmoore
samandmoore previously approved these changes Aug 5, 2026
it 'ignores a nil priority, applying the default instead' do
JobClass.set(priority: nil).perform_later

expect(enqueued_delayed_jobs.last.priority).to eq(10)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we could use a reference to the default priority here if we wanna make this tolerable of change to that value.

@smudge
smudge changed the base branch from smudge/stack/1 to smudge/stack/1.5 August 7, 2026 19:02
@smudge
smudge requested review from effron and samandmoore August 7, 2026 19:10
samandmoore
samandmoore previously approved these changes Aug 7, 2026
Base automatically changed from smudge/stack/1.5 to main August 7, 2026 20:05
It appears that newer versions of ActiveJob's retry_on always pass priority (nil unless specified) to retry_job, so `opts.key?(:priority)` coerced `nil` into `0`.

This means that every `retry_on` retry was silently re-enqueued at priority 0 (unless otherwise specified in the `retry_on` declaration).

stack-info: PR: #119, branch: smudge/stack/2
@smudge
smudge merged commit e6af7c8 into main Aug 7, 2026
48 checks passed
@smudge
smudge deleted the smudge/stack/2 branch August 7, 2026 20:16
smudge added a commit that referenced this pull request Aug 12, 2026
In testing the rollout of [the `Delayed::Limit` concurrency
limiter](#116) feature, we
determined that there were several quality-of-life improvements that
could be made to this gem's integration with `ActiveJob` (specifically
in the usage of the `retry_on` directive).

As such, this release rolls in both #116 and a list of improvements to
the way that `JobWrapper` and `JobPreparer` handle the lifecycle across
`delayed`'s execution layer and `ActiveJob`'s execution layer:

- #119
- #120
- #121
- #122
- #123
- #124
- #127
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants