From c05f8849ce5dc8eb9fe1480d59015614c2618dde Mon Sep 17 00:00:00 2001 From: David M <62346025+dispherical@users.noreply.github.com> Date: Fri, 15 Nov 2024 21:46:23 -0500 Subject: [PATCH] trim deletions every 12 hours (mem leak) --- index.js | 1 + sections/30-recent.js | 2 ++ 2 files changed, 3 insertions(+) diff --git a/index.js b/index.js index 63491df..abfab83 100644 --- a/index.js +++ b/index.js @@ -168,6 +168,7 @@ var activeConnections = []; await require("./utils/pull")({ app, client, prisma }); }, 1000 * 10) cron.schedule("0 0,12 * * *", async () => { + await client.del(`${process.env.INSTANCE_ID || "production"}.messageCache`); await require("./utils/redo")({ app, client, prisma }); await require("./utils/joinall")({ app, client, prisma }); }); diff --git a/sections/30-recent.js b/sections/30-recent.js index 2106c95..11f566c 100644 --- a/sections/30-recent.js +++ b/sections/30-recent.js @@ -57,11 +57,13 @@ module.exports = { channel: process.env.SLACK_CHANNEL, }, ]; + delete messages; return ( `This is a list of conversations that are actively ongoing and that you can jump in at any time and meet new people :yay:\n\n:siren-real: Latest message: (in <#${messages[0].channel}>) ${pms(Date.now() - Math.floor(messages[0].ts * 1000))} ago Below is a scrolling timeline of all messages in Slack going from left to right: ${await generateMessageString(channels, Math.floor(Date.now() / 1000), prisma)} ` + text.replaceAll("@", "​@").replaceAll(/[\u{1F3FB}-\u{1F3FF}]/gmu, "") ); + }, }; \ No newline at end of file