shellphone.app/app/cron-jobs/purge-expired-sessions.ts

15 lines
263 B
TypeScript
Raw Normal View History

2022-05-14 10:22:06 +00:00
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 * * *",
);