2021-03-21 08:38:09 +00:00
|
|
|
// TODO: 消したい
|
|
|
|
|
2019-07-03 11:18:07 +00:00
|
|
|
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);
|
|
|
|
}
|