mirror of
https://github.com/Ylianst/MeshCentral.git
synced 2024-12-27 16:02:16 +03:00
Fixed MongoDB bulk write of events and power events.
This commit is contained in:
parent
31e8c12bca
commit
88ae5a30b4
4
db.js
4
db.js
@ -1901,7 +1901,7 @@ module.exports.CreateDB = function (parent, func) {
|
|||||||
// Perform pending operations
|
// Perform pending operations
|
||||||
obj.dbCounters.eventsSetBulk++;
|
obj.dbCounters.eventsSetBulk++;
|
||||||
var ops = [];
|
var ops = [];
|
||||||
for (var i in obj.eventsFilePendingSets) { ops.push({ document: obj.eventsFilePendingSets[i] }); }
|
for (var i in obj.eventsFilePendingSets) { ops.push({ insertOne: { document: obj.eventsFilePendingSets[i] } }); }
|
||||||
obj.eventsFilePendingCbs = obj.eventsFilePendingCb;
|
obj.eventsFilePendingCbs = obj.eventsFilePendingCb;
|
||||||
obj.eventsFilePendingCb = null;
|
obj.eventsFilePendingCb = null;
|
||||||
obj.eventsFilePendingSets = null;
|
obj.eventsFilePendingSets = null;
|
||||||
@ -1920,7 +1920,7 @@ module.exports.CreateDB = function (parent, func) {
|
|||||||
// Perform pending operations
|
// Perform pending operations
|
||||||
obj.dbCounters.powerSetBulk++;
|
obj.dbCounters.powerSetBulk++;
|
||||||
var ops = [];
|
var ops = [];
|
||||||
for (var i in obj.powerFilePendingSets) { ops.push({ document: obj.powerFilePendingSets[i] }); }
|
for (var i in obj.powerFilePendingSets) { ops.push({ insertOne: { document: obj.powerFilePendingSets[i] } }); }
|
||||||
obj.powerFilePendingCbs = obj.powerFilePendingCb;
|
obj.powerFilePendingCbs = obj.powerFilePendingCb;
|
||||||
obj.powerFilePendingCb = null;
|
obj.powerFilePendingCb = null;
|
||||||
obj.powerFilePendingSets = null;
|
obj.powerFilePendingSets = null;
|
||||||
|
@ -1481,8 +1481,13 @@ module.exports.CreateMeshAgent = function (parent, db, ws, req, args, domain) {
|
|||||||
// TODO: This this extra stats from the tunnel, you can merge this into the tunnel event in the database.
|
// TODO: This this extra stats from the tunnel, you can merge this into the tunnel event in the database.
|
||||||
//console.log(command);
|
//console.log(command);
|
||||||
|
|
||||||
|
// Validate input
|
||||||
|
if ((command.sent == null) || (typeof command.sent != 'string')) return;
|
||||||
|
if ((command.sentActual == null) || (typeof command.sentActual != 'string')) return;
|
||||||
|
if ((command.sentActual == null) || (typeof command.sentActual != 'number')) return;
|
||||||
|
|
||||||
// Event the session closed compression data.
|
// Event the session closed compression data.
|
||||||
var event = { etype: 'node', action: 'sessioncompression', nodeid: obj.dbNodeKey, domain: domain.id, sent: command.sent, sentActual: command.sentActual, msgid: 54, msgArgs: [command.sentRatio, command.sent, command.sentActual], msg: 'Agent closed session with ' + command.sentRatio + '% agent to server compression. Sent: ' + command.sent + ', Compressed: ' + command.sentActual + '.' };
|
var event = { etype: 'node', action: 'sessioncompression', nodeid: obj.dbNodeKey, domain: domain.id, sent: parseInt(command.sent), sentActual: parseInt(command.sentActual), msgid: 54, msgArgs: [command.sentRatio, parseInt(command.sent), parseInt(command.sentActual)], msg: 'Agent closed session with ' + command.sentRatio + '% agent to server compression. Sent: ' + command.sent + ', Compressed: ' + command.sentActual + '.' };
|
||||||
parent.parent.DispatchEvent(parent.CreateMeshDispatchTargets(obj.dbMeshKey, [obj.dbNodeKey]), obj, event);
|
parent.parent.DispatchEvent(parent.CreateMeshDispatchTargets(obj.dbMeshKey, [obj.dbNodeKey]), obj, event);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user