17 lines
489 B
TypeScript
17 lines
489 B
TypeScript
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));
|
|
});
|