parent
037837b551
commit
0e4a111f81
1714 changed files with 20803 additions and 11751 deletions
20
packages/backend/src/daemons/janitor.ts
Normal file
20
packages/backend/src/daemons/janitor.ts
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
// TODO: 消したい
|
||||
|
||||
const interval = 30 * 60 * 1000;
|
||||
import { AttestationChallenges } from '@/models/index';
|
||||
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);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue