Updates for Puma 6

This commit is contained in:
MSP-Greg 2022-09-21 14:46:43 -05:00
parent c6886a1ab0
commit 6c674e4425
No known key found for this signature in database
GPG Key ID: D688DA4A77D8FA18
3 changed files with 11 additions and 6 deletions

View File

@ -79,7 +79,7 @@ end
# Action Cable # Action Cable
group :cable do group :cable do
gem "puma", require: false gem "puma", ">= 5.0.3", require: false
gem "redis", ">= 4.0.1", require: false gem "redis", ">= 4.0.1", require: false

View File

@ -372,7 +372,7 @@ GEM
rack rack
railties (>= 7.0.0.alpha2) railties (>= 7.0.0.alpha2)
public_suffix (4.0.6) public_suffix (4.0.6)
puma (5.5.2) puma (5.6.5)
nio4r (~> 2.0) nio4r (~> 2.0)
queue_classic (4.0.0) queue_classic (4.0.0)
pg (>= 1.1, < 2.0) pg (>= 1.1, < 2.0)
@ -587,7 +587,7 @@ DEPENDENCIES
nokogiri (>= 1.8.1, != 1.11.0) nokogiri (>= 1.8.1, != 1.11.0)
pg (~> 1.3) pg (~> 1.3)
propshaft (>= 0.1.7) propshaft (>= 0.1.7)
puma puma (>= 5.0.3)
queue_classic (>= 4.0.0) queue_classic (>= 4.0.0)
racc (>= 1.4.6) racc (>= 1.4.6)
rack-cache (~> 1.2) rack-cache (~> 1.2)

View File

@ -74,10 +74,15 @@ class ClientTest < ActionCable::TestCase
end end
def with_puma_server(rack_app = ActionCable.server, port = 3099) def with_puma_server(rack_app = ActionCable.server, port = 3099)
server = ::Puma::Server.new(rack_app, ::Puma::Events.strings) opts = { min_threads: 1, max_threads: 4 }
server = if Puma::Const::PUMA_VERSION >= "6"
opts[:log_writer] = ::Puma::LogWriter.strings
::Puma::Server.new(rack_app, nil, opts)
else
# Puma >= 5.0.3
::Puma::Server.new(rack_app, ::Puma::Events.strings, opts)
end
server.add_tcp_listener "127.0.0.1", port server.add_tcp_listener "127.0.0.1", port
server.min_threads = 1
server.max_threads = 4
thread = server.run thread = server.run