Update camo to use my fork

Increases MongoDB compatibility and adds it's own method for compacting NeDB data files
This commit is contained in:
benji7425 2018-01-27 00:37:17 +00:00
parent f1f81a9ba4
commit 17eb0554fe
3 changed files with 62 additions and 56 deletions

View File

@ -75,7 +75,7 @@ module.exports = class Client extends Discord.Client {
if (dbProtocol === "nedb") {
CoreUtil.dateLog(`Seting up NeDB collection compaction cron job; schedule: ${InternalConfig.neDBCompactionSchedule}`);
new CronJob(InternalConfig.neDBCompactionSchedule, compactNeDBCollections, null, true);
new CronJob(InternalConfig.neDBCompactionSchedule, () => database.compactCollectionFiles(), null, true);
}
this.emit("beforeLogin");
@ -90,13 +90,4 @@ module.exports = class Client extends Discord.Client {
guildData.delete();
});
}
};
function compactNeDBCollections() {
/*I realise it is a bit of a cheat to just access _collections in this manner, but in the absence of
camo actually having any kind of solution for this it's the easiest method I could come up with.
Maybe at some point in future I should fork camo and add this feature. The compaction function is NeDB only
and camo is designed to work with both NeDB and MongoDB, which is presumably why it doesn't alraedy exist */
for (let collectionName of Object.keys(database._collections))
database._collections[collectionName].persistence.compactDatafile();
}
};

View File

@ -47,42 +47,40 @@
"resolved": "https://registry.npmjs.org/bson/-/bson-1.0.4.tgz",
"integrity": "sha1-k8ENOeqltYQVy8QFLz5T5WKwtyw="
},
"buffer-shims": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/buffer-shims/-/buffer-shims-1.0.0.tgz",
"integrity": "sha1-mXjOMXOIxkmth5MCjDR37wRKi1E=",
"optional": true
},
"camo": {
"version": "0.12.3",
"resolved": "https://registry.npmjs.org/camo/-/camo-0.12.3.tgz",
"integrity": "sha1-NuKKWV2c5vgG6tEy2+CLI86T+Rs=",
"version": "git+https://github.com/benji7425/camo.git#fd71a6e82c001cb6a8b5b680fe6a0e3d218c7390",
"requires": {
"depd": "1.1.0",
"lodash": "3.9.3",
"mongodb": "2.0.42",
"mongodb": "2.2.34",
"nedb": "1.8.0"
},
"dependencies": {
"bson": {
"version": "0.4.23",
"resolved": "https://registry.npmjs.org/bson/-/bson-0.4.23.tgz",
"integrity": "sha1-5louPHUH/63kEJvHV1p25Q+NqRU=",
"optional": true
},
"mongodb": {
"version": "2.0.42",
"resolved": "https://registry.npmjs.org/mongodb/-/mongodb-2.0.42.tgz",
"integrity": "sha1-G614E9ByXOLjvVQYDzH67dJNnlM=",
"version": "2.2.34",
"resolved": "https://registry.npmjs.org/mongodb/-/mongodb-2.2.34.tgz",
"integrity": "sha1-o09Zu+thdUrsQy3nLD/iFSakTBo=",
"optional": true,
"requires": {
"es6-promise": "2.1.1",
"mongodb-core": "1.2.10",
"readable-stream": "1.0.31"
"es6-promise": "3.2.1",
"mongodb-core": "2.1.18",
"readable-stream": "2.2.7"
}
},
"mongodb-core": {
"version": "1.2.10",
"resolved": "https://registry.npmjs.org/mongodb-core/-/mongodb-core-1.2.10.tgz",
"integrity": "sha1-7OFyAb05WmR/uY9Ivo+64Vvgr9k=",
"version": "2.1.18",
"resolved": "https://registry.npmjs.org/mongodb-core/-/mongodb-core-2.1.18.tgz",
"integrity": "sha1-TEYTm986HwMt7ZHbSfOO7AFlkFA=",
"optional": true,
"requires": {
"bson": "0.4.23",
"kerberos": "0.0.23"
"bson": "1.0.4",
"require_optional": "1.0.1"
}
}
}
@ -128,9 +126,9 @@
}
},
"es6-promise": {
"version": "2.1.1",
"resolved": "https://registry.npmjs.org/es6-promise/-/es6-promise-2.1.1.tgz",
"integrity": "sha1-A+jzxyl5KOVHjWqx0GQyUVB73t0=",
"version": "3.2.1",
"resolved": "https://registry.npmjs.org/es6-promise/-/es6-promise-3.2.1.tgz",
"integrity": "sha1-7FYjOGgDKQkgcXDDlEjiREndH8Q=",
"optional": true
},
"esmangle-evaluator": {
@ -193,15 +191,6 @@
"source-map": "0.1.31"
}
},
"kerberos": {
"version": "0.0.23",
"resolved": "https://registry.npmjs.org/kerberos/-/kerberos-0.0.23.tgz",
"integrity": "sha1-aqRq/bl4bGkZOIzFtAjwEscfD9E=",
"optional": true,
"requires": {
"nan": "2.5.1"
}
},
"lie": {
"version": "3.0.2",
"resolved": "https://registry.npmjs.org/lie/-/lie-3.0.2.tgz",
@ -274,12 +263,6 @@
"require_optional": "1.0.1"
}
},
"nan": {
"version": "2.5.1",
"resolved": "https://registry.npmjs.org/nan/-/nan-2.5.1.tgz",
"integrity": "sha1-1bAWkSUzJql6K77p5hxV2NYDUeI=",
"optional": true
},
"nedb": {
"version": "1.8.0",
"resolved": "https://registry.npmjs.org/nedb/-/nedb-1.8.0.tgz",
@ -312,16 +295,42 @@
"resolved": "https://registry.npmjs.org/private/-/private-0.1.8.tgz",
"integrity": "sha512-VvivMrbvd2nKkiG38qjULzlc+4Vx4wm/whI9pQD35YrARNnhxeiRktSOhSukRLFNlzg6Br/cJPet5J/u19r/mg=="
},
"process-nextick-args": {
"version": "1.0.7",
"resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-1.0.7.tgz",
"integrity": "sha1-FQ4gt1ZZCtP5EJPyWk8q2L/zC6M=",
"optional": true
},
"readable-stream": {
"version": "1.0.31",
"resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-1.0.31.tgz",
"integrity": "sha1-jyUC4LyeOw2huUUgqrtOJgPsr64=",
"version": "2.2.7",
"resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.2.7.tgz",
"integrity": "sha1-BwV6y+JGeyIELTb5jFrVBwVOlbE=",
"optional": true,
"requires": {
"buffer-shims": "1.0.0",
"core-util-is": "1.0.2",
"inherits": "2.0.3",
"isarray": "0.0.1",
"string_decoder": "0.10.31"
"isarray": "1.0.0",
"process-nextick-args": "1.0.7",
"string_decoder": "1.0.3",
"util-deprecate": "1.0.2"
},
"dependencies": {
"isarray": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz",
"integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=",
"optional": true
},
"string_decoder": {
"version": "1.0.3",
"resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.0.3.tgz",
"integrity": "sha512-4AH6Z5fzNNBcH+6XDMfA/BTt87skxqJlO0lAh3Dker5zThcAxG6mKz+iGu308UKoPPQ8Dcqx/4JhujzltRa+hQ==",
"optional": true,
"requires": {
"safe-buffer": "5.1.1"
}
}
}
},
"recast": {
@ -451,6 +460,12 @@
"through2": "0.6.5"
}
},
"util-deprecate": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz",
"integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=",
"optional": true
},
"ws": {
"version": "3.3.2",
"resolved": "https://registry.npmjs.org/ws/-/ws-3.3.2.tgz",

View File

@ -2,7 +2,7 @@
"version": "1.0.0",
"main": "index.js",
"dependencies": {
"camo": "0.12.3",
"camo": "git+https://github.com/benji7425/camo.git",
"cron": "1.3.0",
"discord.js": "11.2.0",
"mongodb": "3.0.1",