mirror of
https://github.com/idanoo/autobrr
synced 2025-07-23 00:39:13 +00:00
feat(feeds): add scheduled cleanup (#1073)
* refactor(feeds): make feed scheduling more robust * feat(feeds): add daily cleanup job * removes feed cache older than 30 days * fix(feeds): fmt wrong type
This commit is contained in:
parent
cfc2436d50
commit
6fd8626507
11 changed files with 301 additions and 215 deletions
|
@ -214,7 +214,7 @@ func (j *TorznabJob) getFeed(ctx context.Context) ([]torznab.FeedItem, error) {
|
|||
continue
|
||||
}
|
||||
|
||||
exists, err := j.CacheRepo.Exists(j.Name, i.GUID)
|
||||
exists, err := j.CacheRepo.Exists(j.Feed.ID, i.GUID)
|
||||
if err != nil {
|
||||
j.Log.Error().Err(err).Msg("could not check if item exists")
|
||||
continue
|
||||
|
@ -229,7 +229,7 @@ func (j *TorznabJob) getFeed(ctx context.Context) ([]torznab.FeedItem, error) {
|
|||
// set ttl to 1 month
|
||||
ttl := time.Now().AddDate(0, 1, 0)
|
||||
|
||||
if err := j.CacheRepo.Put(j.Name, i.GUID, []byte(i.Title), ttl); err != nil {
|
||||
if err := j.CacheRepo.Put(j.Feed.ID, i.GUID, []byte(i.Title), ttl); err != nil {
|
||||
j.Log.Error().Stack().Err(err).Str("guid", i.GUID).Msg("cache.Put: error storing item in cache")
|
||||
continue
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue