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 assertion that jobs are never nested in the ActiveJob extension #369

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
5 changes: 0 additions & 5 deletions lib/que/active_job/extensions.rb
Original file line number Diff line number Diff line change
Expand Up @@ -82,11 +82,6 @@ def run(args)
# option under the circumstances (doesn't require hacking ActiveJob in
# any more extensive way).

# There's no reason this logic should ever nest, because it wouldn't
# make sense to run a worker inside of a job, but even so, assert that
# nothing absurd is going on.
Que.assert NilClass, Thread.current[:que_current_job]

Copy link
Contributor

Choose a reason for hiding this comment

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

This method has only been overridden by an ActiveJob test support helper specifically to prevent this assertion from making the Rails test suite fail. This assertion still runs in production on Rails.

It's possible that removing the assertion is ok, but I would like to have a better grasp as to why it was added in the first place before we do. If there is some logic downstream from this point that depends on the fact that jobs are not nested, then removing the assertion may make the Rails test suite pass but could break que.

begin
Thread.current[:que_current_job] = self

Expand Down