Files
Emmelia-Link-Flayer-Rewrite/controllers/rssController.js

30 lines
867 B
JavaScript

//Will handle updating feeds in all channels
const { DebugBuilder } = require("../utilities/debugBuilder");
const log = new DebugBuilder("server", "rssController");
const libCore = require("../libCore");
const libUtils = require("../libUtils");
const timeoutValue = process.env.RSS_TIMEOUT_VALUE ?? 300000;
exports.RSSController = class RSSController {
constructor(_client) {
this.client = _client;
}
async start(){
log.INFO("Starting RSS Controller");
await libCore.updateFeeds(this.client);
while(true){
await new Promise(resolve => setTimeout(resolve, timeoutValue));
this.collectLatestPosts();
}
}
async collectLatestPosts(){
log.INFO("Updating sources");
libCore.updateFeeds(this.client)
return;
}
}