forked from Outils-PeerTube/listener-rss-aggregator
some tests fixes + adding sqlite package
This commit is contained in:
@ -22,21 +22,20 @@ export class ManageListener extends EventEmitter {
|
||||
constructor(info?: ManageListenerInfo) {
|
||||
super();
|
||||
if (info) {
|
||||
if (info.timeloop) {
|
||||
this.timeloop = info.timeloop;
|
||||
}
|
||||
if (info.path) {
|
||||
const fs = require("fs");
|
||||
const tmp = fs.readFileSync(info.path);
|
||||
const configs: ListenerRSSInfos[] = JSON.parse(tmp);
|
||||
configs.forEach((config) => this.addNewListener(config));
|
||||
}
|
||||
if (info.timeloop) {
|
||||
this.timeloop = info.timeloop;
|
||||
this.buffUpdates = [];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
settingEvents(newListener: ListenerRss): void {
|
||||
if (this.timeloop) {
|
||||
if (this.timeloop !== undefined) {
|
||||
newListener.on("update", (obj) => this.buffUpdates.push(obj));
|
||||
newListener.on("newEntries", (obj) => this.buffNewEntries.push(obj));
|
||||
// /!\ todo /!\ threat error with aggregation
|
||||
@ -74,7 +73,13 @@ export class ManageListener extends EventEmitter {
|
||||
if (this.timeloop) {
|
||||
const fun: () => void = async () => {
|
||||
this.emit("update", this.buffUpdates);
|
||||
this.emit("newEntries", this.buffNewEntries);
|
||||
if (this.buffNewEntries.length) {
|
||||
console.log(this.buffNewEntries.length);
|
||||
this.emit("newEntries", this.buffNewEntries);
|
||||
}
|
||||
|
||||
this.buffUpdates = [];
|
||||
this.buffNewEntries = [];
|
||||
};
|
||||
|
||||
(async () => {
|
||||
|
Reference in New Issue
Block a user