mirror of
https://git.joinfirefish.org/firefish/firefish.git
synced 2024-05-19 05:31:11 +02:00
30619301d3
959cc8ff37
Co-authored-by: zyoshoka <107108195+zyoshoka@users.noreply.github.com>
21 lines
401 B
TypeScript
21 lines
401 B
TypeScript
// TODO: 消したい
|
|
|
|
const interval = 30 * 60 * 1000;
|
|
import { AttestationChallenges } from "@/models/index.js";
|
|
import { LessThan } from "typeorm";
|
|
|
|
/**
|
|
* Clean up database occasionally
|
|
*/
|
|
export default function () {
|
|
async function tick() {
|
|
await AttestationChallenges.delete({
|
|
createdAt: LessThan(new Date(Date.now() - 5 * 60 * 1000)),
|
|
});
|
|
}
|
|
|
|
tick();
|
|
|
|
setInterval(tick, interval);
|
|
}
|