some tests fixes + adding sqlite package

This commit is contained in:
2021-04-10 17:41:39 +02:00
parent 6c9c49dbba
commit abce92964e
12 changed files with 4434 additions and 283 deletions

View File

@ -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 () => {