diff options
Diffstat (limited to 'internal/scrobbler')
| -rw-r--r-- | internal/scrobbler/db.go | 7 | ||||
| -rw-r--r-- | internal/scrobbler/scrobbler.go | 2 |
2 files changed, 7 insertions, 2 deletions
diff --git a/internal/scrobbler/db.go b/internal/scrobbler/db.go index 7b97b82..1125798 100644 --- a/internal/scrobbler/db.go +++ b/internal/scrobbler/db.go @@ -3,6 +3,7 @@ package scrobbler import ( "database/sql" "fmt" + "log" "os" _ "github.com/mattn/go-sqlite3" @@ -17,7 +18,11 @@ func initdb(dbpath string) error { if err != nil { return err } - defer db.Close() + defer func() { + if err := db.Close(); err != nil { + log.Printf("failed to close database: %v", err) + } + }() sqlStmt := `create table records (id text primary key, title text, diff --git a/internal/scrobbler/scrobbler.go b/internal/scrobbler/scrobbler.go index 694f9ff..8cb8f9e 100644 --- a/internal/scrobbler/scrobbler.go +++ b/internal/scrobbler/scrobbler.go @@ -89,7 +89,7 @@ func (s *Scrobbler) Run() error { log.Printf("failed to update record %s: %s", previousRecord.Id, err) } previousRecord = currentRecord - s.save(currentRecord) + _ = s.save(currentRecord) } } } |
