From 64d1224a36391358089752feb5925399c9a50a42 Mon Sep 17 00:00:00 2001 From: Matthew R Date: Fri, 4 Jun 2021 22:54:58 -0400 Subject: [PATCH] remove Score Historicals older than 30 days --- src/class/Queue.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/class/Queue.ts b/src/class/Queue.ts index 26ec570..647e3a5 100644 --- a/src/class/Queue.ts +++ b/src/class/Queue.ts @@ -43,7 +43,12 @@ export default class Queue { } }); + const clearOldHistoricalReportsJob = new cron.CronJob('0 20 * * *', async () => { + this.client.db.ScoreHistorical.remove({ date: { $lt: new Date(Date.now() - 30 * 24 * 60 * 60 * 1000) } }); + }); + historialCommunityReportJob.start(); + clearOldHistoricalReportsJob.start(); } public async jobCounts() {