1
0
Fork 0
mirror of https://github.com/Ylianst/MeshCentral.git synced 2025-03-09 15:40:18 +00:00
This commit is contained in:
PTR 2025-03-05 19:22:06 -08:00 committed by GitHub
commit 522bb9c832
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

12
db.js
View file

@ -699,9 +699,15 @@ module.exports.CreateDB = function (parent, func) {
return r;
}
// Clone an object (TODO: Make this more efficient)
function Clone(v) { return JSON.parse(JSON.stringify(v)); }
// Clone an object (TODO: Make this more efficient) >> Use StructuredClone from v17 onward
let Clone;
if (process.versions.node.split('.')[0] >= '17'){
Clone = function (v) { return structuredClone(v); }
}
else {
Clone = function (v) { return JSON.parse(JSON.stringify(v)); }
}
// Read expiration time from configuration file
if (typeof parent.args.dbexpire == 'object') {
if (typeof parent.args.dbexpire.events == 'number') { expireEventsSeconds = parent.args.dbexpire.events; }