Module: Wurk::Client::Buffered::ForkHook

Included in:
Wurk::Client::Buffered
Defined in:
lib/wurk/client/buffered.rb

Overview

Ruby >= 3.1 routes every fork / Process.fork through Process._fork, which is the only way to catch the forks Wurk never sees: a Puma or Unicorn parent that preloaded the app — and may already be holding buffered payloads — spawning its workers. Registered at require time because reliable_push! can be installed after the fork that copied the state. Guarded on the fork-less runtimes (JRuby), where there is no super to call.

Instance Method Summary collapse

Instance Method Details

#_forkObject



482
483
484
485
486
# File 'lib/wurk/client/buffered.rb', line 482

def _fork
  pid = super
  Buffered.reset_after_fork! if pid.zero?
  pid
end