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

Fix usage of ActiveJob::Base.queue_name #517

Merged
merged 1 commit into from
Nov 12, 2024

Conversation

leoarnold
Copy link
Contributor

In activejob the class method MyJob.queue_name returns a Proc. To obtain the actual queue name, we need to invoke the method on an instance of the job class, e.g. MyJob.new.queue_name.

The test suite was unable to detect this problem because a mocked version of the ActiveJob::Base class was used which did not act in the same way as the actual activejob gem.

We fix this by testing against the actual activejob gem.

Fixes #512.

In `activejob` the class method `MyJob.queue_name` returns a `Proc`.
To obtain the actual queue name, we need to invoke the method on
an instance of the job class, e.g. `MyJob.new.queue_name`.

The test suite was unable to detect this problem because a mocked
version of the `ActiveJob::Base` class was used which did not act
in the same way as the actual `activejob` gem.

We fix this by testing against the actual `activejob` gem.

Fixes sidekiq-cron#512.
Copy link
Member

@markets markets left a comment

Choose a reason for hiding this comment

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

Nice 👏

@markets markets merged commit df5b8cf into sidekiq-cron:master Nov 12, 2024
12 checks passed
@leoarnold leoarnold deleted the leoarnold/queue_name branch March 6, 2025 09:08
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.

Problem with queue in Rails 7.2
2 participants