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:
parent
5870f04260
commit
778346b0b0
8 changed files with 275 additions and 186 deletions
|
@ -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)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue