MCPcopy Create free account
hub / github.com/CloudBoost/cloudboost / removeFiles

Function removeFiles

cron/expire.js:16–32  ·  view source on GitHub ↗
(appId, curr)

Source from the content-addressed store, hash-verified

14
15
16function removeFiles(appId, curr) {
17 try {
18 const collectionName = 'File';
19 const collectionId = mongoUtil.collection.getId(appId, collectionName);
20 const collection = config.mongoClient.db(appId).collection(collectionId);
21 const query = { expires: { $lt: curr, $exists: true, $ne: null } };
22 const promises = [];
23 collection.find(query).toArray().then((res) => {
24 for (let i = 0; i < res.length; i++) {
25 promises.push(fileService.delete(appId, res[i], null, true));
26 }
27 q.all(promises).then(() => {}, () => {});
28 }, () => {});
29 } catch (err) {
30 winston.log('error', { error: String(err), stack: new Error().stack });
31 }
32}
33
34function mongodb(appId, collectionName, curr) {
35 try {

Callers 1

expire.jsFile · 0.85

Calls 3

findMethod · 0.80
allMethod · 0.80
deleteMethod · 0.45

Tested by

no test coverage detected