You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

20 lines
615 B

import { start, stop } from "../scheduler/engine";
import { registerTask } from "../scheduler/registry";
import cleanupLogs from "../scheduler/tasks/cleanup-logs";
const MAX_CONCURRENCY = Number(process.env.SCHEDULER_MAX_CONCURRENCY) || 5;
const LOG_RETENTION_DAYS = Number(process.env.SCHEDULER_LOG_RETENTION_DAYS) || 30;
if (import.meta.dev) {
console.log("plugin: 03.scheduler");
}
registerTask("cleanup-logs", cleanupLogs);
export default defineNitroPlugin(async (nitroApp) => {
await start(MAX_CONCURRENCY, LOG_RETENTION_DAYS);
nitroApp.hooks.hook("close", async () => {
await stop();
});
});