1
0
Fork 0
mirror of https://github.com/puma/puma.git synced 2022-11-09 13:48:40 -05:00

Fix stat & TestCLI#test_control_for_tcp (#1470)

This commit is contained in:
MSP-Greg 2017-12-11 15:05:36 -06:00 committed by Nate Berkopec
parent 101e496f70
commit 5a6f3f2b34
3 changed files with 5 additions and 5 deletions

View file

@ -279,8 +279,8 @@ module Puma
while true
sleep WORKER_CHECK_INTERVAL
begin
b = server.backlog
r = server.running
b = server.backlog || 0
r = server.running || 0
payload = %Q!#{base_payload}{ "backlog":#{b}, "running":#{r} }\n!
io << payload
rescue IOError

View file

@ -5,8 +5,8 @@ require 'puma/plugin'
module Puma
class Single < Runner
def stats
b = @server.backlog
r = @server.running
b = @server.backlog || 0
r = @server.running || 0
%Q!{ "backlog": #{b}, "running": #{r} }!
end

View file

@ -56,7 +56,7 @@ class TestCLI < Minitest::Test
s = TCPSocket.new "127.0.0.1", 9877
s << "GET /stats HTTP/1.0\r\n\r\n"
body = s.read
assert_equal '{ "backlog": 0, "running": 0 }', body.split("\r\n").last
assert_equal '{ "backlog": 0, "running": 0 }', body.split(/\r?\n/).last
cli.launcher.stop
t.join