mirror of
https://github.com/monkeytypegame/monkeytype.git
synced 2025-03-12 23:20:25 +08:00
deleting old logs
This commit is contained in:
parent
8ec8a68562
commit
adac26883a
1 changed files with 12 additions and 0 deletions
|
@ -92,4 +92,16 @@ app.listen(PORT, async () => {
|
|||
LeaderboardsDAO.update("time", "60", "english");
|
||||
});
|
||||
lbjob.start();
|
||||
|
||||
let logjob = new CronJob("0 0 0 * * *", async () => {
|
||||
let data = await mongoDB()
|
||||
.collection("logs")
|
||||
.deleteMany({ timestamp: { $lt: Date.now() - 604800000 } });
|
||||
Logger.log(
|
||||
"system_logs_deleted",
|
||||
`${data.deletedCount} logs deleted older than 7 days`,
|
||||
undefined
|
||||
);
|
||||
});
|
||||
logjob.start();
|
||||
});
|
||||
|
|
Loading…
Reference in a new issue