Add back missing pubdate check
This commit is contained in:
@ -242,6 +242,15 @@ export const rssHandler = Sentry.GCPFunction.wrapHttpFunction(
|
||||
const feed = await parser.parseString(fetchResult.content)
|
||||
console.log('Fetched feed', feed.title, new Date())
|
||||
|
||||
const feedPubDate = (feed['dc:date'] ||
|
||||
feed.pubDate ||
|
||||
feed.lastBuildDate) as string | undefined
|
||||
console.log('Feed pub date', feedPubDate)
|
||||
if (feedPubDate && new Date(feedPubDate) < new Date(lastFetchedAt)) {
|
||||
console.log('Skipping old feed', feedPubDate)
|
||||
return res.send('ok')
|
||||
}
|
||||
|
||||
// save each item in the feed
|
||||
for (const item of feed.items) {
|
||||
// use published or updated if isoDate is not available for atom feeds
|
||||
|
||||
Reference in New Issue
Block a user