Commit 87170726 authored by Wandenberg Peixoto's avatar Wandenberg Peixoto

fix return of detailed statistics wich fails with many channels

parent da8a3b09
......@@ -299,7 +299,5 @@ ngx_http_push_stream_send_response_all_channels_info_detailed(ngx_http_request_t
r->keepalive = 0;
// send content tail
ngx_http_push_stream_send_response_chunk(r, tail->data, tail->len, 1);
return NGX_DONE;
return ngx_http_push_stream_send_response_chunk(r, tail->data, tail->len, 1);
}
......@@ -360,4 +360,30 @@ class TestChannelStatistics < Test::Unit::TestCase
}
end
def config_test_get_detailed_channels_statistics_to_many_channels
@max_reserved_memory = '200m'
end
def test_get_detailed_channels_statistics_to_many_channels
headers = {'accept' => 'application/json'}
channel = 'ch_test_get_detailed_channels_statistics_to_many_channels_'
body = 'body'
number_of_channels = 20000
#create channel
number_of_channels.times { |i| publish_message("#{channel}#{i}", headers, body) }
EventMachine.run {
pub_2 = EventMachine::HttpRequest.new(nginx_address + '/channels-stats?id=ALL').get :head => headers, :timeout => 30
pub_2.callback {
assert_equal(200, pub_2.response_header.status, "Request was not accepted")
assert_not_equal(0, pub_2.response_header.content_length, "Empty response was received")
response = JSON.parse(pub_2.response)
assert_equal(number_of_channels, response["infos"].length, "Didn't received info about the created channels")
EventMachine.stop
}
fail_if_connecttion_error(pub_2)
}
end
end
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment