def before_handling_requests(forked, options)
if forked
srand
end
if options["process_title"] && !options["process_title"].empty?
$0 = options["process_title"] + ": " + options["app_group_name"]
end
if forked && options["analytics_logger"]
options["analytics_logger"].clear_connection
end
if forked && defined?(ActiveRecord::Base)
if ActiveRecord::Base.respond_to?(:clear_all_connections!)
ActiveRecord::Base.clear_all_connections!
elsif ActiveRecord::Base.respond_to?(:clear_active_connections!)
ActiveRecord::Base.clear_active_connections!
elsif ActiveRecord::Base.respond_to?(:connected?) &&
ActiveRecord::Base.connected?
ActiveRecord::Base.establish_connection
end
end
PhusionPassenger.call_event(:starting_worker_process, forked)
if options["pool_account_username"] && options["pool_account_password_base64"]
password = options["pool_account_password_base64"].unpack('m').first
PhusionPassenger.call_event(:credentials,
options["pool_account_username"], password)
else
PhusionPassenger.call_event(:credentials, nil, nil)
end
end