mirror of
https://github.com/miniflux/v2.git
synced 2025-08-31 18:31:01 +00:00
Remove debug timer from most storage functions
This commit is contained in:
parent
4295a86e55
commit
0dff432337
7 changed files with 0 additions and 88 deletions
|
@ -8,10 +8,8 @@ import (
|
|||
"database/sql"
|
||||
"fmt"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"miniflux.app/model"
|
||||
"miniflux.app/timer"
|
||||
)
|
||||
|
||||
// HasIcon checks if the given feed has an icon.
|
||||
|
@ -24,8 +22,6 @@ func (s *Storage) HasIcon(feedID int64) bool {
|
|||
|
||||
// IconByID returns an icon by the ID.
|
||||
func (s *Storage) IconByID(iconID int64) (*model.Icon, error) {
|
||||
defer timer.ExecutionTime(time.Now(), "[Storage:IconByID]")
|
||||
|
||||
var icon model.Icon
|
||||
query := `SELECT id, hash, mime_type, content FROM icons WHERE id=$1`
|
||||
err := s.db.QueryRow(query, iconID).Scan(&icon.ID, &icon.Hash, &icon.MimeType, &icon.Content)
|
||||
|
@ -40,7 +36,6 @@ func (s *Storage) IconByID(iconID int64) (*model.Icon, error) {
|
|||
|
||||
// IconByFeedID returns a feed icon.
|
||||
func (s *Storage) IconByFeedID(userID, feedID int64) (*model.Icon, error) {
|
||||
defer timer.ExecutionTime(time.Now(), fmt.Sprintf("[Storage:IconByFeedID] userID=%d, feedID=%d", userID, feedID))
|
||||
query := `
|
||||
SELECT
|
||||
icons.id, icons.hash, icons.mime_type, icons.content
|
||||
|
@ -62,8 +57,6 @@ func (s *Storage) IconByFeedID(userID, feedID int64) (*model.Icon, error) {
|
|||
|
||||
// IconByHash returns an icon by the hash (checksum).
|
||||
func (s *Storage) IconByHash(icon *model.Icon) error {
|
||||
defer timer.ExecutionTime(time.Now(), "[Storage:IconByHash]")
|
||||
|
||||
err := s.db.QueryRow(`SELECT id FROM icons WHERE hash=$1`, icon.Hash).Scan(&icon.ID)
|
||||
if err == sql.ErrNoRows {
|
||||
return nil
|
||||
|
@ -76,8 +69,6 @@ func (s *Storage) IconByHash(icon *model.Icon) error {
|
|||
|
||||
// CreateIcon creates a new icon.
|
||||
func (s *Storage) CreateIcon(icon *model.Icon) error {
|
||||
defer timer.ExecutionTime(time.Now(), "[Storage:CreateIcon]")
|
||||
|
||||
query := `
|
||||
INSERT INTO icons
|
||||
(hash, mime_type, content)
|
||||
|
@ -101,8 +92,6 @@ func (s *Storage) CreateIcon(icon *model.Icon) error {
|
|||
|
||||
// CreateFeedIcon creates an icon and associate the icon to the given feed.
|
||||
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 {
|
||||
return err
|
||||
|
@ -125,7 +114,6 @@ func (s *Storage) CreateFeedIcon(feedID int64, icon *model.Icon) error {
|
|||
|
||||
// Icons returns all icons tht belongs to a user.
|
||||
func (s *Storage) Icons(userID int64) (model.Icons, error) {
|
||||
defer timer.ExecutionTime(time.Now(), fmt.Sprintf("[Storage:Icons] userID=%d", userID))
|
||||
query := `
|
||||
SELECT
|
||||
icons.id, icons.hash, icons.mime_type, icons.content
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue