Run message cleanup more frequently with a lower limit

This commit is contained in:
Dragory 2020-05-28 02:52:31 +03:00
parent 26f1042b8e
commit bf3cae2201
No known key found for this signature in database
GPG key ID: 5F387BA66DF8AAC1

View file

@ -7,7 +7,7 @@ import moment from "moment-timezone";
import { DAYS, MINUTES } from "../utils"; import { DAYS, MINUTES } from "../utils";
import { isAPI } from "../globals"; import { isAPI } from "../globals";
const CLEANUP_INTERVAL = 5 * MINUTES; const CLEANUP_INTERVAL = 1 * MINUTES;
/** /**
* How long message edits, deletions, etc. will include the original message content. * How long message edits, deletions, etc. will include the original message content.
@ -42,7 +42,7 @@ async function cleanup() {
qb.andWhere("is_permanent = 0"); qb.andWhere("is_permanent = 0");
}), }),
) )
.limit(100_000) // To avoid long table locks, limit the amount of messages deleted at once .limit(10_000) // To avoid long table locks, limit the amount of messages deleted at once
.delete() .delete()
.execute(); .execute();