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
530 B
20 lines
530 B
import { syncAllDueFeeds } from "#server/service/rss";
|
|
|
|
const MIN_INTERVAL_MS = 60_000;
|
|
|
|
export default defineNitroPlugin(() => {
|
|
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);
|
|
});
|
|
|