Skip to content

Detect subclasses of the Solid Queue adapter - #799

Open
rosa wants to merge 1 commit into
mainfrom
detect-solid-queue-adapter-subclasses
Open

Detect subclasses of the Solid Queue adapter#799
rosa wants to merge 1 commit into
mainfrom
detect-solid-queue-adapter-subclasses

Conversation

@rosa

@rosa rosa commented Aug 30, 2026

Copy link
Copy Markdown
Member

Fixes #489.

RecurringTask#using_solid_queue_adapter? compared the adapter's name to "solid_queue", so a job class using a subclass of ActiveJob::QueueAdapters::SolidQueueAdapter (the reporter's case: picking a shard at enqueue time) was treated as a foreign adapter and its recurring runs were enqueued through perform_later without a RecurringExecution row. The batches code had copied the same comparison into ActiveJob::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

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
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.

More flexible using_solid_queue_adapter? check

1 participant