Skip to content

Commit

Permalink
trim deletions every 12 hours (mem leak)
Browse files Browse the repository at this point in the history
  • Loading branch information
dispherical committed Nov 16, 2024
1 parent 1f072aa commit c05f884
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
1 change: 1 addition & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 });
});
Expand Down
2 changes: 2 additions & 0 deletions sections/30-recent.js
Original file line number Diff line number Diff line change
Expand Up @@ -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, "")
);

},
};

0 comments on commit c05f884

Please sign in to comment.