Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix stat & TestCLI#test_control_for_tcp #1470

Merged
merged 1 commit into from Dec 11, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions lib/puma/cluster.rb
Expand Up @@ -279,8 +279,8 @@ def worker(index, master)
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
Expand Down
4 changes: 2 additions & 2 deletions lib/puma/single.rb
Expand Up @@ -5,8 +5,8 @@
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

Expand Down
2 changes: 1 addition & 1 deletion test/test_cli.rb
Expand Up @@ -56,7 +56,7 @@ def test_control_for_tcp
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
Expand Down