[ActiveRecord] Accept pool_class option #42783
Closed
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.
Context: #42271
There's lots of exciting work going in Ruby 3.0 with fibers, non-blocking IO and support for custom schedulers. Eventually we'd like to run Rails apps with ActiveRecord in non-blocking servers like Falcon. Those servers would require the code not to rely on thread-local variables, which ActiveRecord connection pool does right now.
This PR is an attempt to allow AR to take
pool_classas an option to DB configuration. It will allow @ioquatix and the async ruby team to implement a fiber-local connection pool, and to run ActiveRecord on non-blocking servers.main...kirs:async-rb is a quick and dirty example how a custom connection pool implementation might look like.