Module: RactorRailsShim::InstallStrategy::Thread

Defined in:
lib/ractor_rails_shim/roles/install_strategy.rb

Overview

Minimal install for thread (Puma/Falcon) servers: only the class_attribute isolation fix + nil-safe callback replay. The other patches route framework globals through per-Ractor IES, which is empty on Puma's request threads and would break the app, so they are skipped; the original Rails globals are thread-safe and used as-is.

Class Method Summary collapse

Class Method Details

.installObject



50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
# File 'lib/ractor_rails_shim/roles/install_strategy.rb', line 50

def self.install
  RactorRailsShim.install_class_attribute
  RactorRailsShim.install_execution_wrapper
  # Capture each controller's OWN declared before_action/after_action
  # filters at declaration time (during eager load) by intercepting
  # ActiveSupport::Callbacks.set_callback. This must be installed
  # BEFORE eager load so declarations are captured as they happen —
  # the class_attribute callback chain is corrupted by an eager-load
  # leak under Ruby 4.0.5 + Rails 8.1.3 + Devise, so reading
  # __callbacks later yields a wrong, unshareable chain. Install
  # requires active_support/callbacks to be loaded, so require it
  # first; install runs before the app's eager_load, so every
  # controller declaration is captured.
  require "active_support/callbacks" rescue nil
  RactorRailsShim::CallbackCapture.install_callback_declaration_capture!
end