Rename db to fdb

This commit is contained in:
Balakrishnan Balasubramanian 2022-06-17 17:06:45 -04:00
parent 27bea0c91b
commit 87990aa922

View File

@ -63,7 +63,7 @@ func ProcessFeed(feed *FeedCfg, scheduler schedule.Scheduler, dbDir string, tgra
return return
} }
db, err := NewDB(dbDir, feed.Name) fdb, err := NewDB(dbDir, feed.Name)
if err != nil { if err != nil {
log.Error("failed to get db", "feed", feed.Name, "db_dir", dbDir, "error", err) log.Error("failed to get db", "feed", feed.Name, "db_dir", dbDir, "error", err)
return return
@ -102,7 +102,7 @@ func ProcessFeed(feed *FeedCfg, scheduler schedule.Scheduler, dbDir string, tgra
var records []Record var records []Record
var newEntries []parser.FeedEntry var newEntries []parser.FeedEntry
if db.IsNewFeed() { if fdb.IsNewFeed() {
stat.New = stat.Total stat.New = stat.Total
ftl := int(feed.FirstTimeLimit) ftl := int(feed.FirstTimeLimit)
if feed.FirstTimeLimit == NoLimit || len(entries) <= ftl { if feed.FirstTimeLimit == NoLimit || len(entries) <= ftl {
@ -121,7 +121,7 @@ func ProcessFeed(feed *FeedCfg, scheduler schedule.Scheduler, dbDir string, tgra
stat.Filtered = len(filteredEntries) stat.Filtered = len(filteredEntries)
} }
} else { } else {
newEntries, err = db.Filter(entries) newEntries, err = fdb.Filter(entries)
if err != nil { if err != nil {
log.Error("failed to filter entries", "feed", feed.Name, "error", err) log.Error("failed to filter entries", "feed", feed.Name, "error", err)
return return
@ -144,7 +144,7 @@ func ProcessFeed(feed *FeedCfg, scheduler schedule.Scheduler, dbDir string, tgra
} }
records = append(records, r) records = append(records, r)
} }
err = db.Save(records) err = fdb.Save(records)
if err != nil { if err != nil {
log.Error("failed to save sent records", "feed", feed.Name, "num_records", len(records), "error", err) log.Error("failed to save sent records", "feed", feed.Name, "num_records", len(records), "error", err)
} }