Module: RactorRailsShim::Lifecycle
- Defined in:
- lib/ractor_rails_shim/roles/lifecycle.rb
Class Method Summary collapse
-
.prepare_for_ractors! ⇒ Object
Run after Rails.application.initialize! and BEFORE spawning worker Ractors.
Class Method Details
.prepare_for_ractors! ⇒ Object
Run after Rails.application.initialize! and BEFORE spawning worker Ractors. Makes every registered constant shareable (deep-freeze), freezes shareable class ivars, dispatches all framework patches, snapshots gem paths, and warms caches.
Idempotent; safe to call multiple times. Must run in the main Ractor.
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/ractor_rails_shim/roles/lifecycle.rb', line 24 def self.prepare_for_ractors! PreSpawnSteps.apply_shareable_constants PreSpawnSteps.freeze_shareable_class_ivars PreSpawnSteps.install_framework_patches RactorRailsShim.__send__(:_seed_active_storage_prefix!) if RactorRailsShim.respond_to?(:_seed_active_storage_prefix!, true) RactorRailsShim.__send__(:_freeze_secure_random_alphabets!) if RactorRailsShim.respond_to?(:_freeze_secure_random_alphabets!, true) RactorRailsShim.snapshot_gem_paths! RactorRailsShim.snapshot_query_logs! RactorRailsShim.install_url_helpers_patch RactorRailsShim.fix_url_helpers_singleton_routes! Freezers::CacheWarmer.call Freezers::ClassIvarFreezer.call Freezers::GlobalClassIvarFreezer.call Freezers::GlobalConstantFreezer.call Freezers::MessagesConstantsFreezer.call end |