forked from FoundKeyGang/FoundKey
expire AuthSessions after 15 min
This commit is contained in:
parent
6ec3d61753
commit
3939f0f37b
1 changed files with 6 additions and 2 deletions
|
@ -1,6 +1,6 @@
|
||||||
import Bull from 'bull';
|
import Bull from 'bull';
|
||||||
import { In, LessThan } from 'typeorm';
|
import { In, LessThan } from 'typeorm';
|
||||||
import { AttestationChallenges, Mutings, PasswordResetRequests, Signins } from '@/models/index.js';
|
import { AttestationChallenges, AuthSessions, Mutings, PasswordResetRequests, Signins } from '@/models/index.js';
|
||||||
import { publishUserEvent } from '@/services/stream.js';
|
import { publishUserEvent } from '@/services/stream.js';
|
||||||
import { MINUTE, DAY } from '@/const.js';
|
import { MINUTE, DAY } from '@/const.js';
|
||||||
import { queueLogger } from '@/queue/logger.js';
|
import { queueLogger } from '@/queue/logger.js';
|
||||||
|
@ -40,7 +40,11 @@ export async function checkExpired(job: Bull.Job<Record<string, unknown>>, done:
|
||||||
createdAt: LessThan(new Date(new Date().getTime() - 30 * MINUTE)),
|
createdAt: LessThan(new Date(new Date().getTime() - 30 * MINUTE)),
|
||||||
});
|
});
|
||||||
|
|
||||||
logger.succ('Deleted expired mutes, signins and attestation challenges.');
|
await AuthSessions.delete({
|
||||||
|
createdAt: LessThan(new Date(new Date().getTime() - 15 * MINUTE)),
|
||||||
|
});
|
||||||
|
|
||||||
|
logger.succ('Deleted expired data.');
|
||||||
|
|
||||||
done();
|
done();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue