forked from rails/rails
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Never connect to the database in define_attribute_methods initializer
Followup: rails#48743 After careful consideration, unless users have a schema cache dump loaded and `check_schema_cache_dump_version = false`, we have no choice but to arbitrate between resiliency and performance. If we define attribute methods during boot, we allow them to be shared between forked workers, and prevent the first requests to be slower. However, by doing so we'd trigger a connection to the datase, which if it's unresponsive could lead to workers not being able to restart triggering a cascading failure. Previously Rails used to be in some sort of middle-ground where it would define attribute methods during boot if for some reason it was already connected to the database at this point. But this is now deemed undesirable, as an application initializer inadvertantly establishing the database connection woudl lead to a readically different behavior.
- Loading branch information
Showing
2 changed files
with
22 additions
and
24 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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