1
0
Fork 0
mirror of https://github.com/miniflux/v2.git synced 2025-09-15 18:57:04 +00:00

Simplify feed fetcher

- Add browser package to handle HTTP errors
- Reduce code duplication
This commit is contained in:
Frédéric Guillot 2018-10-14 21:43:48 -07:00
parent 5870f04260
commit 778346b0b0
8 changed files with 275 additions and 186 deletions

View file

@ -100,8 +100,8 @@ func (s *Storage) CreateIcon(icon *model.Icon) error {
}
// CreateFeedIcon creates an icon and associate the icon to the given feed.
func (s *Storage) CreateFeedIcon(feed *model.Feed, icon *model.Icon) error {
defer timer.ExecutionTime(time.Now(), fmt.Sprintf("[Storage:CreateFeedIcon] feedID=%d", feed.ID))
func (s *Storage) CreateFeedIcon(feedID int64, icon *model.Icon) error {
defer timer.ExecutionTime(time.Now(), fmt.Sprintf("[Storage:CreateFeedIcon] feedID=%d", feedID))
err := s.IconByHash(icon)
if err != nil {
@ -115,7 +115,7 @@ func (s *Storage) CreateFeedIcon(feed *model.Feed, icon *model.Icon) error {
}
}
_, err = s.db.Exec(`INSERT INTO feed_icons (feed_id, icon_id) VALUES ($1, $2)`, feed.ID, icon.ID)
_, err = s.db.Exec(`INSERT INTO feed_icons (feed_id, icon_id) VALUES ($1, $2)`, feedID, icon.ID)
if err != nil {
return fmt.Errorf("unable to create feed icon: %v", err)
}