Skip to content

Node.js based forum software built for the modern web

show how many nodes responded

Barış Soner Uşaklıaf6cde553418
diff --git a/public/language/en-GB/admin/development/info.json b/public/language/en-GB/admin/development/info.json
index b2768ca212..24bf179655 100644
--- a/public/language/en-GB/admin/development/info.json
+++ b/public/language/en-GB/admin/development/info.json
@@ -1,5 +1,6 @@
{
"you-are-on": "Info - You are on <strong>%1:%2</strong>",
+ "nodes-responded": "%1 nodes responded within %2ms!",
"host": "host",
"pid": "pid",
"nodejs": "nodejs",
diff --git a/src/controllers/admin/info.js b/src/controllers/admin/info.js
index 88fef98b4b..94c2b2c0d4 100644
--- a/src/controllers/admin/info.js
+++ b/src/controllers/admin/info.js
@@ -16,22 +16,30 @@ var info = {};
infoController.get = function (req, res) {
info = {};
pubsub.publish('sync:node:info:start');
+ var timeoutMS = 1000;
setTimeout(function () {
var data = [];
Object.keys(info).forEach(function (key) {
data.push(info[key]);
});
data.sort(function (a, b) {
- if (a.os.hostname < b.os.hostname) {
+ if (a.id < b.id) {
return -1;
}
- if (a.os.hostname > b.os.hostname) {
+ if (a.id > b.id) {
return 1;
}
return 0;
});
- res.render('admin/development/info', { info: data, infoJSON: JSON.stringify(data, null, 4), host: os.hostname(), port: nconf.get('port') });
- }, 500);
+ res.render('admin/development/info', {
+ info: data,
+ infoJSON: JSON.stringify(data, null, 4),
+ host: os.hostname(),
+ port: nconf.get('port'),
+ nodeCount: data.length,
+ timeout: timeoutMS
+ });
+ }, timeoutMS);
};
pubsub.on('sync:node:info:start', function () {
@@ -39,7 +47,8 @@ pubsub.on('sync:node:info:start', function () {
if (err) {
return winston.error(err);
}
- pubsub.publish('sync:node:info:end', { data: data, id: os.hostname() + ':' + nconf.get('port') });
+ data.id = os.hostname() + ':' + nconf.get('port');
+ pubsub.publish('sync:node:info:end', { data: data, id: data.id });
});
});
diff --git a/src/views/admin/development/info.tpl b/src/views/admin/development/info.tpl
index 50963d4d8c..4a6d9b90b3 100644
--- a/src/views/admin/development/info.tpl
+++ b/src/views/admin/development/info.tpl
@@ -5,6 +5,8 @@
</div>
<div class="panel-body">
+ <span>[[admin/development/info:nodes-responded, {nodeCount}, {timeOut}]]</span>
+
<table class="table table-striped">
<thead>
<tr>