fix(feeds): process RSS on initial run (#918)

This commit is contained in:
ze0s 2023-05-07 15:55:04 +02:00 committed by GitHub
parent b0b98b8d9c
commit 01a69c7582
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -227,12 +227,6 @@ func (j *RSSJob) getFeed(ctx context.Context) (items []*gofeed.Item, err error)
//sort.Sort(feed) //sort.Sort(feed)
bucketCount, err := j.CacheRepo.GetCountByBucket(ctx, bucketKey)
if err != nil {
j.Log.Error().Err(err).Msg("could not check if item exists")
return nil, err
}
// set ttl to 1 month // set ttl to 1 month
ttl := time.Now().AddDate(0, 1, 0) ttl := time.Now().AddDate(0, 1, 0)
@ -264,12 +258,9 @@ func (j *RSSJob) getFeed(ctx context.Context) (items []*gofeed.Item, err error)
continue continue
} }
// first time we fetch the feed the cached bucket count will be 0 // only append if we successfully added to cache
// only append to items if it's bigger than 0, so we get new items only
if bucketCount > 0 {
items = append(items, item) items = append(items, item)
} }
}
// send to filters // send to filters
return return