From 326635f43a2ae024fb9aa1de780a03f6bd89b3c4 Mon Sep 17 00:00:00 2001 From: dev-737 <73829355+dev-737@users.noreply.github.com> Date: Mon, 6 Mar 2023 10:39:10 +0530 Subject: [PATCH] fix(msgData): Changed delete interval to 24h --- src/Events/ready.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/Events/ready.ts b/src/Events/ready.ts index 37befbc5..5e287780 100644 --- a/src/Events/ready.ts +++ b/src/Events/ready.ts @@ -14,19 +14,19 @@ export default { const db = getDb(); const messageData = db.messageData; - // set a property called "expired" to a document that is older than 4 hours. + // set a property called "expired" to a document that is older than 12 hours. setInterval(async () => { - const older_than_four = new Date(Date.now() - 60 * 60 * 4000); // 4 hours before now + const older_than_four = new Date(Date.now() - 60 * 60 * 12_000); // 12 hours before now await messageData.updateMany({ where: { timestamp: { lte: older_than_four.getTime() } }, data: { expired: true }, }); - }, 60 * 60 * 4100); + }, 60 * 60 * 12_100); - // Delete all documents that have the property "expired" set to true. + // Delete all documents that has the property "expired" set to true. setInterval(async () => { await messageData?.deleteMany({ where: { expired: true } }); - }, 60 * 60 * 12_000); + }, 60 * 60 * 24_000); if (client.isReady()) { const blacklistedServers = await db.blacklistedServers.findMany({ where: { expires: { isSet: true } } });