Repository navigation
fix(rails): don't load Active Record or Active Job when enabling solid_queue_recurring - #3242
Open
pcbeingused333 wants to merge 2 commits into
Open
pcbeingused333 wants to merge 2 commits into
pcbeingused333 wants to merge 2 commits into
Conversation
…d_queue_recurring The patch checked SolidQueue::RecurringTask from a to_prepare callback, which autoloaded the model, and with it Active Record and Active Job, before the app finished initializing. Prepend from the autoloader's on_load callback instead. Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
solnic
requested changes
Nov 25, 2026
solnic
left a comment
Collaborator
There was a problem hiding this comment.
Thanks for addressing this. Please remove the regression spec though, it feels like an overkill to cover this specific case with a dedicated scenario. We could consider adding an e2e smoke test scenario later on to cover reloading/eager/lazy loading that would ensure our patches work as expected.
Author
|
Removed the isolated boot regression spec and its fixture as requested. The existing Solid Queue and recurring job specs passed with 90 examples on Rails 8.1. This comment was drafted with Claude Code. |
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 #3237
With
config.enabled_patches << :solid_queue_recurringand eager loading off, ato_preparecallback evaluated::SolidQueue::RecurringTask < .... That autoloaded the model, and with it Active Record and Active Job, before the application had finished initializing, so Rails logged its early load hook warnings.The prepend now runs from
Rails.autoloaders.main.on_load("SolidQueue::RecurringTask"), as suggested in the issue. It fires when the model is first loaded and again after each code reload. If the model is already loaded when the patch is applied (for exampleSentry.initafter boot), it is patched right away.A new isolated spec boots a fresh Rails app with eager loading off and on. With it off, it checks that neither framework is loaded before initialization and that the patch survives a reload. The eager loading off case fails without the fix.
No
CHANGELOG.mdentry, followingAGENTS.md.This change was prepared with AI assistance.