diff --git a/src/config/index.ts b/src/config/index.ts index bef3be9..501031d 100644 --- a/src/config/index.ts +++ b/src/config/index.ts @@ -3,7 +3,7 @@ export default { port: parseInt(process.env.APP_PORT ?? "8000"), feed: { url: process.env.FEED_URL ?? "http://www.peto-media.fi/tiedotteet/rss.xml", - schedule: parseInt(process.env.FEED_SCHEDULE ?? "2"), + schedule: process.env.FEED_SCHEDULE ?? "* * * * *", }, database: { host: process.env.DB_HOST, diff --git a/src/cron.ts b/src/cron.ts index d3f0647..cc39c04 100644 --- a/src/cron.ts +++ b/src/cron.ts @@ -1,13 +1,13 @@ import EventEmitter from "events"; import cron from "node-cron"; + import logger from "./logger"; import config from "./config"; - import { sqlEventService, feedService } from "./services"; const feedScraper = (): EventEmitter => { const feedEventEmitter = new EventEmitter(); - cron.schedule(`*/${config.feed.schedule} * * * *`, async () => { + cron.schedule(config.feed.schedule, async () => { const rawFeed = await feedService.decodeFeed(); const events = await feedService.mapFeedToEvents(rawFeed); for (const event of events) {