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.
 
 
 
 

22 lines
607 B

import { syncAllDueFeeds } from "#server/service/rss";
const MIN_INTERVAL_MS = 60_000;
export default defineNitroPlugin((nitroApp) => {
nitroApp.hooks.hook("ready", () => {
const minutes = Number(process.env.RSS_SYNC_INTERVAL_MINUTES ?? 60);
const intervalMs = Math.max(minutes * 60_000, MIN_INTERVAL_MS);
setInterval(() => {
syncAllDueFeeds().catch((e) => {
console.error("[rss-scheduler]", e);
});
}, intervalMs);
setTimeout(() => {
syncAllDueFeeds().catch((e) => {
console.error("[rss-scheduler] startup", e);
});
}, 5000);
});
});