mirror of
https://iceshrimp.dev/iceshrimp/iceshrimp
synced 2024-12-21 10:08:05 +09:00
19 lines
378 B
TypeScript
19 lines
378 B
TypeScript
|
const interval = 30 * 60 * 1000;
|
||
|
import { AttestationChallenges } from '../models';
|
||
|
import { LessThan } from 'typeorm';
|
||
|
|
||
|
/**
|
||
|
* Clean up database occasionally
|
||
|
*/
|
||
|
export default function() {
|
||
|
async function tick() {
|
||
|
await AttestationChallenges.delete({
|
||
|
createdAt: LessThan(new Date(new Date().getTime() - 5 * 60 * 1000))
|
||
|
});
|
||
|
}
|
||
|
|
||
|
tick();
|
||
|
|
||
|
setInterval(tick, interval);
|
||
|
}
|