Skip to content

Commit

Permalink
Merge pull request #136 from marocchino/puma6
Browse files Browse the repository at this point in the history
Update puma registration for puma 6
  • Loading branch information
searls authored Oct 17, 2022
2 parents 50dbbf9 + 54ecbc5 commit eeab7f0
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions lib/cypress-rails/server/puma.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,18 @@ def self.create(app, port, host)

conf = Rack::Handler::Puma.config(app, options)
conf.clamp
events = ::Puma::Events.stdio
logger = (defined?(::Puma::LogWriter) ? ::Puma::LogWriter : ::Puma::Events).stdio

puma_ver = Gem::Version.new(::Puma::Const::PUMA_VERSION)
require_relative "patches/puma_ssl" if (Gem::Version.new("4.0.0")...Gem::Version.new("4.1.0")).cover? puma_ver

events.log "Starting Puma..."
events.log "* Version #{::Puma::Const::PUMA_VERSION} , codename: #{::Puma::Const::CODE_NAME}"
events.log "* Min threads: #{conf.options[:min_threads]}, max threads: #{conf.options[:max_threads]}"
logger.log "Starting Puma..."
logger.log "* Version #{::Puma::Const::PUMA_VERSION} , codename: #{::Puma::Const::CODE_NAME}"
logger.log "* Min threads: #{conf.options[:min_threads]}, max threads: #{conf.options[:max_threads]}"

::Puma::Server.new(conf.app, events, conf.options).tap do |s|
s.binder.parse conf.options[:binds], s.events
s.min_threads, s.max_threads = conf.options[:min_threads], conf.options[:max_threads]
::Puma::Server.new(conf.app, defined?(::Puma::LogWriter) ? nil : logger, conf.options).tap do |s|
s.binder.parse conf.options[:binds], s.respond_to?(:log_writer) ? s.log_writer : s.events
s.min_threads, s.max_threads = conf.options[:min_threads], conf.options[:max_threads] if s.respond_to?(:min_threads=)
end.run.join
end
end
Expand Down

0 comments on commit eeab7f0

Please sign in to comment.