Tweak initialSync logic to ensure we don't get perform it forever

Before this no entries were saved after an initialSync,
making us thing it's an initialSync every time.
This commit is contained in:
Tadeusz Sośnierz 2022-04-22 14:09:18 +02:00
parent 428ca02456
commit 2d712be3c0

View File

@ -118,12 +118,14 @@ export class FeedReader {
try {
const res = await axios.get(url.toString());
const feed = await (new Parser()).parseString(res.data);
const seenGuids = this.seenEntries.get(url) || [];
const seenGuidsSet = new Set(seenGuids);
let initialSync = false;
if (seenGuidsSet.size === 0) {
let seenGuids = this.seenEntries.get(url);
if (!seenGuids) {
initialSync = true;
seenGuids = [];
seenEntriesChanged = true; // to ensure we only treat it as an initialSync once
}
const seenGuidsSet = new Set(seenGuids);
const newGuids = [];
log.debug(`Found ${feed.items.length} entries in ${url}`);
for (const item of feed.items) {