|
@@ -14,6 +14,7 @@ var od_ref = db.ref("devices").child(config.device_id).child("ondemand");
|
|
|
|
|
|
var proc;
|
|
var proc;
|
|
|
|
|
|
|
|
+
|
|
function process_queue() {
|
|
function process_queue() {
|
|
if (working) return;
|
|
if (working) return;
|
|
working = true;
|
|
working = true;
|
|
@@ -87,7 +88,7 @@ function addAndProc(key, job) {
|
|
function start() {
|
|
function start() {
|
|
queue = [];
|
|
queue = [];
|
|
|
|
|
|
- od_ref.on("child_added", snp => {
|
|
|
|
|
|
+ od_ref.orderByChild('fromTime').on("child_added", snp => {
|
|
console.log("added", snp.key);
|
|
console.log("added", snp.key);
|
|
addAndProc(snp.key, snp.val());
|
|
addAndProc(snp.key, snp.val());
|
|
});
|
|
});
|
|
@@ -102,7 +103,8 @@ endpoint.get('/info', function(request, response) {
|
|
response.send(JSON.stringify({
|
|
response.send(JSON.stringify({
|
|
'version': version,
|
|
'version': version,
|
|
'processID': process.id,
|
|
'processID': process.id,
|
|
- 'memoryUsage': process.memoryUsage().rss
|
|
|
|
|
|
+ 'memoryUsage': process.memoryUsage().rss,
|
|
|
|
+ 'queueSize': queue.length
|
|
}));
|
|
}));
|
|
});
|
|
});
|
|
endpoint.listen(49223);
|
|
endpoint.listen(49223);
|