Module: Hyperion::AsyncPg::ForkSafe::Hook
- Defined in:
- lib/hyperion/async_pg/fork_safe.rb
Overview
Prepended onto ‘Process.singleton_class` so we cooperate cleanly with other libraries that wrap `Process._fork` (notably `Async::ForkHandler` from the async gem, which uses the same technique). `super` chains through the next handler in the ancestor stack rather than rebinding to a snapshot of the C method, which avoided a self-recursing wrapper bug we hit when using `define_method` + `Method#call` (Async’s prepend dispatched ‘super` back to our singleton-class-defined wrapper, which called the captured Method, which dispatched `super` back into the wrapper).
Instance Method Summary collapse
Instance Method Details
#_fork(&block) ⇒ Object
56 57 58 59 60 |
# File 'lib/hyperion/async_pg/fork_safe.rb', line 56 def _fork(&block) result = super ForkSafe.reset_all_pools_in_child! if result.zero? result end |