Initial commit
This commit is contained in:
16
server/plugins/drop-cleanup.ts
Normal file
16
server/plugins/drop-cleanup.ts
Normal file
@@ -0,0 +1,16 @@
|
||||
import { cleanupExpiredDrops } from "../utils/drop-store";
|
||||
|
||||
export default defineNitroPlugin((nitroApp) => {
|
||||
cleanupExpiredDrops().catch((error) =>
|
||||
console.error("[quickdrop] Initial expiry cleanup failed.", error),
|
||||
);
|
||||
|
||||
const timer = setInterval(() => {
|
||||
cleanupExpiredDrops().catch((error) =>
|
||||
console.error("[quickdrop] Scheduled expiry cleanup failed.", error),
|
||||
);
|
||||
}, 60 * 1000);
|
||||
timer.unref();
|
||||
|
||||
nitroApp.hooks.hook("close", () => clearInterval(timer));
|
||||
});
|
||||
Reference in New Issue
Block a user