mirror of
https://github.com/matrix-org/matrix-hookshot.git
synced 2025-03-10 21:19:13 +00:00
Don't notify about new RSS/Atom entries during initial sync
This commit is contained in:
parent
420def07b0
commit
9217112c3e
@ -97,6 +97,10 @@ export class FeedReader {
|
|||||||
const feed = await (new Parser()).parseString(res.data);
|
const feed = await (new Parser()).parseString(res.data);
|
||||||
const seenGuids = this.seenEntries.get(url) || [];
|
const seenGuids = this.seenEntries.get(url) || [];
|
||||||
const seenGuidsSet = new Set(seenGuids);
|
const seenGuidsSet = new Set(seenGuids);
|
||||||
|
let initialSync = false;
|
||||||
|
if (seenGuidsSet.size === 0) {
|
||||||
|
initialSync = true;
|
||||||
|
}
|
||||||
const newGuids = [];
|
const newGuids = [];
|
||||||
log.debug(`Found ${feed.items.length} entries in ${url}`);
|
log.debug(`Found ${feed.items.length} entries in ${url}`);
|
||||||
for (const item of feed.items) {
|
for (const item of feed.items) {
|
||||||
@ -106,10 +110,16 @@ export class FeedReader {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
newGuids.push(guid);
|
newGuids.push(guid);
|
||||||
|
|
||||||
|
if (initialSync) {
|
||||||
|
log.debug(`Skipping entry ${guid} since we're performing an initial sync`);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
if (seenGuidsSet.has(guid)) {
|
if (seenGuidsSet.has(guid)) {
|
||||||
log.debug('Skipping already seen entry', guid);
|
log.debug('Skipping already seen entry', guid);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
const entry = {
|
const entry = {
|
||||||
feed: { title: stripHtml(feed.title!), url: url.toString() },
|
feed: { title: stripHtml(feed.title!), url: url.toString() },
|
||||||
title: stripHtml(item.title!),
|
title: stripHtml(item.title!),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user