remixed v0
This commit is contained in:
3
app/cron-jobs/index.ts
Normal file
3
app/cron-jobs/index.ts
Normal file
@ -0,0 +1,3 @@
|
||||
import registerPurgeExpiredSession from "./purge-expired-sessions";
|
||||
|
||||
export default [registerPurgeExpiredSession];
|
14
app/cron-jobs/purge-expired-sessions.ts
Normal file
14
app/cron-jobs/purge-expired-sessions.ts
Normal file
@ -0,0 +1,14 @@
|
||||
import db from "~/utils/db.server";
|
||||
import { CronJob } from "~/utils/queue.server";
|
||||
|
||||
export default CronJob(
|
||||
"purge expired sessions",
|
||||
async () => {
|
||||
await db.session.deleteMany({
|
||||
where: {
|
||||
expiresAt: { lt: new Date() },
|
||||
},
|
||||
});
|
||||
},
|
||||
"0 0 * * *",
|
||||
);
|
Reference in New Issue
Block a user