added history request/response log
This commit is contained in:
parent
bf1aed7370
commit
61b5ddd125
3
app.js
3
app.js
@ -65,6 +65,7 @@ api.on('connection', function(spark) {
|
|||||||
|
|
||||||
if(Nodes.getHistory().requiresUpdate() && !askedForHistory && Nodes.canNodeUpdate(data.id))
|
if(Nodes.getHistory().requiresUpdate() && !askedForHistory && Nodes.canNodeUpdate(data.id))
|
||||||
{
|
{
|
||||||
|
console.log("asked " + data.id + " for history");
|
||||||
spark.emit('history', Nodes.getHistory().getHistoryRequestInterval());
|
spark.emit('history', Nodes.getHistory().getHistoryRequestInterval());
|
||||||
askedForHistory = true;
|
askedForHistory = true;
|
||||||
}
|
}
|
||||||
@ -89,6 +90,7 @@ api.on('connection', function(spark) {
|
|||||||
|
|
||||||
if(Nodes.getHistory().requiresUpdate() && !askedForHistory && Nodes.canNodeUpdate(data.id))
|
if(Nodes.getHistory().requiresUpdate() && !askedForHistory && Nodes.canNodeUpdate(data.id))
|
||||||
{
|
{
|
||||||
|
console.log("asked " + data.id + " for history");
|
||||||
spark.emit('history', Nodes.getHistory().getHistoryRequestInterval());
|
spark.emit('history', Nodes.getHistory().getHistoryRequestInterval());
|
||||||
askedForHistory = true;
|
askedForHistory = true;
|
||||||
}
|
}
|
||||||
@ -96,6 +98,7 @@ api.on('connection', function(spark) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
spark.on('history', function(data){
|
spark.on('history', function(data){
|
||||||
|
console.log("got history from " + data.id);
|
||||||
client.write({action: 'charts', data: Nodes.addHistory(data.id, data.history)});
|
client.write({action: 'charts', data: Nodes.addHistory(data.id, data.history)});
|
||||||
askedForHistory = false;
|
askedForHistory = false;
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user