module Sqreen::WebServer::Puma
Public Class Methods
active?()
click to toggle source
# File lib/sqreen/web_server/puma.rb, line 9 def self.active? Sqreen::Dependency.const_exist?('Puma::Runner') && ObjectSpace.each_object(::Puma::Runner).count > 0 end
Public Instance Methods
after_fork() { || ... }
click to toggle source
# File lib/sqreen/web_server/puma.rb, line 40 def after_fork after_fork = lambda do |_| yield end (configuration.options[:before_worker_boot] ||= []) << after_fork end
before_fork() { || ... }
click to toggle source
# File lib/sqreen/web_server/puma.rb, line 33 def before_fork before_fork = lambda do |_ = nil| # 3.x sends an arg but <3.0 doesn't yield end (configuration.options[:before_fork] || []) << before_fork end
forking?()
click to toggle source
# File lib/sqreen/web_server/puma.rb, line 13 def forking? !cluster.nil? end
master?()
click to toggle source
# File lib/sqreen/web_server/puma.rb, line 21 def master? # HACK: expects outside calling timimg # - with preloading, this is hit early in master and records its PID # - without preloading but forking, the app will be loaded in the child, so recorded PID stays nil # - without forking, master makes no sense, recorded PID stays nil master! if preload_app? Sqreen.log.debug "[#{Process.pid}] master? #{@master_pid == Process.pid}" @master_pid == Process.pid end
preload_app?()
click to toggle source
# File lib/sqreen/web_server/puma.rb, line 17 def preload_app? forking? && (cluster && cluster.preload? || false) end
Private Instance Methods
cluster()
click to toggle source
# File lib/sqreen/web_server/puma.rb, line 53 def cluster return unless ::Puma.const_defined?('Cluster') ObjectSpace.each_object(::Puma::Cluster).first end
configuration()
click to toggle source
# File lib/sqreen/web_server/puma.rb, line 59 def configuration ObjectSpace.each_object(::Puma::Configuration).first end
master!()
click to toggle source
# File lib/sqreen/web_server/puma.rb, line 49 def master! @master_pid ||= Process.pid end