Repository navigation
Conversation
The proc's self is the routes file context, so the route set cannot be made Ractor-shareable (Rails main's experimental Rails.application.ractorize!). A module with matches? is shareable and keeps the behavior.
Owner
|
Hi @mhenrixon, thanks for the PR. Merged a version of this in the commit above. However, I wasn't able to get the test suite working with |
Contributor
Author
|
Appreciate the fast action @ankane, I clearly have more work to do. I have a few open issues towards rails to fix some stuff as well so I expect a lot to be needed before everything works together. I'll use that branch and keep testing. Appreciate you! |
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.
This replaces the
constraints: proc { ... }on the(:database)scope with a module that responds tomatches?. The check is the same, so behavior doesn't change.Rails main has an experimental
Rails.application.ractorize!. It makes the route set Ractor-shareable at boot, and withActiveSupport::Ractors.unshareable_proc_action = :raiseset, an unshareable proc stops the boot. The proc'sselfis the routes file context, so it can't be made shareable. Apps with PgHero installed then fail to boot, even if they never request a PgHero page.Before (Ruby 4.0.7, Rails main, a small app that boots, calls
ractorize!and serves two requests in a Ractor):After: the app boots and serves both requests.
This only fixes boot. Serving PgHero's own pages from a Ractor needs more work, starting in Rails.
I added tests for a valid and an unknown
databasesegment (the unknown one returns a 500 without the constraint).bundle exec rake testpasses on Ruby 4.0 with Active Record 8.1 and on Ruby 3.3 with Active Record 7.2.