Work in progress on integration of IVIS.

Some fixes.
This commit is contained in:
Tomas Bures 2019-08-31 11:46:18 +02:00
parent 3a17d7fd75
commit 2aaa8f45b3
11 changed files with 188 additions and 12 deletions

View file

@ -1,7 +1,37 @@
'use strict';
const moment = require('moment');
const activityQueueLenthThreshold = 100;
const actitivyQueue = [];
let processQueueIsRunning = false;
async function processQueue() {
if (processQueueIsRunning) {
return;
}
processQueueIsRunning = true;
// XXX submit data to IVIS if configured in config
actitivyQueue.splice(0);
processQueueIsRunning = false;
}
async function _logActivity(typeId, data) {
// TODO
actitivyQueue.push({
typeId,
data,
timestamp: moment.utc().toISOString()
});
if (actitivyQueue.length >= activityQueueLenthThreshold) {
// noinspection ES6MissingAwait
processQueue();
}
}
/*