added node cleanup refresh timeout for 1h

This commit is contained in:
cubedro 2015-05-11 22:03:08 +03:00
parent e6baedd6ed
commit be4654aee7
2 changed files with 16 additions and 1 deletions

15
app.js
View File

@ -185,6 +185,21 @@ var latencyTimeout = setInterval( function ()
client.write({ action: 'client-ping' });
}, 5000);
// Cleanup old inactive nodes
var nodeCleanupTimeout = setInterval( function ()
{
client.write({
action: 'init',
data: Nodes.all()
});
client.write({
action: 'charts',
data: Nodes.getCharts()
});
}, 1000*60);
// view engine setup
app.set('views', path.join(__dirname, 'views'));
app.set('view engine', 'jade');

View File

@ -2,7 +2,7 @@ var geoip = require('geoip-lite');
var _ = require('lodash');
var MAX_HISTORY = 40;
var MAX_INACTIVE_TIME = 1000;
var MAX_INACTIVE_TIME = 1000*60*4;
var Node = function Node(data)
{