Detect subclasses of the Solid Queue adapter - #799
Open
rosa wants to merge 1 commit into
Open
Conversation
RecurringTask#using_solid_queue_adapter? and ActiveJob::BatchId#solid_queue_job? compared the adapter's name to "solid_queue", so a job class using a subclass of ActiveJob::QueueAdapters::SolidQueueAdapter (to pick a shard at enqueue time, in the reporter's case) was treated as a foreign adapter: its recurring runs were enqueued through perform_later without a recurring execution row, and its jobs never joined a batch. Check the adapter's ancestry instead. The constant is resolvable wherever the gem is loaded, as the gem's Zeitwerk loader registers it as an autoload on ActiveJob::QueueAdapters. Fixes #489. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01CACej2M9mLVDwpE3Bk8V41
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #489.
RecurringTask#using_solid_queue_adapter?compared the adapter's name to"solid_queue", so a job class using a subclass ofActiveJob::QueueAdapters::SolidQueueAdapter(the reporter's case: picking a shard at enqueue time) was treated as a foreign adapter and its recurring runs were enqueued throughperform_laterwithout aRecurringExecutionrow. The batches code had copied the same comparison intoActiveJob::BatchId#solid_queue_job?, so such jobs never joined a batch either. Both now check the adapter's ancestry.The constant is resolvable wherever the gem is loaded, even in a process that never configures the adapter: the gem's Zeitwerk loader registers it as an autoload on
ActiveJob::QueueAdapters(verified in a bare Ruby process).Two tests, one per site, with a named adapter subclass; both fail on main and pass with the fix. Changed files green on sqlite, MySQL and PostgreSQL; full sqlite suite green (357 runs).
🤖 Generated with Claude Code
https://claude.ai/code/session_01CACej2M9mLVDwpE3Bk8V41