mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-18 11:30:55 +01:00
Minor improvements for handling of /status/
for Aphlict
Summary: We don't need to handle any request data for the `/status/` route, so we can simplify this code slightly. Test Plan: ```lang=bash > curl http://127.0.0.1:22281/status/ {"uptime":2543,"clients.active":0,"clients.total":0,"messages.in":0,"messages.out":0,"log":"/var/log/aphlict.log","version":6} ``` Reviewers: #blessed_reviewers, epriestley Reviewed By: #blessed_reviewers, epriestley Subscribers: Korvin, epriestley Differential Revision: https://secure.phabricator.com/D11145
This commit is contained in:
parent
44198d68a7
commit
9f31e023f4
1 changed files with 12 additions and 19 deletions
|
@ -226,12 +226,6 @@ http.createServer(function(request, response) {
|
||||||
response.end();
|
response.end();
|
||||||
}
|
}
|
||||||
} else if (request.url == '/status/') {
|
} else if (request.url == '/status/') {
|
||||||
request.on('data', function() {
|
|
||||||
// We just ignore the request data, but newer versions of Node don't
|
|
||||||
// get to 'end' if we don't process the data. See T2953.
|
|
||||||
});
|
|
||||||
|
|
||||||
request.on('end', function() {
|
|
||||||
var status = {
|
var status = {
|
||||||
'uptime': (new Date().getTime() - start_time),
|
'uptime': (new Date().getTime() - start_time),
|
||||||
'clients.active': clients.getActiveListenerCount(),
|
'clients.active': clients.getActiveListenerCount(),
|
||||||
|
@ -245,7 +239,6 @@ http.createServer(function(request, response) {
|
||||||
response.writeHead(200, {'Content-Type': 'application/json'});
|
response.writeHead(200, {'Content-Type': 'application/json'});
|
||||||
response.write(JSON.stringify(status));
|
response.write(JSON.stringify(status));
|
||||||
response.end();
|
response.end();
|
||||||
});
|
|
||||||
} else {
|
} else {
|
||||||
response.statusCode = 404;
|
response.statusCode = 404;
|
||||||
response.write('404 Not Found\n');
|
response.write('404 Not Found\n');
|
||||||
|
|
Loading…
Reference in a new issue