aboutsummaryrefslogtreecommitdiffstats
path: root/data.go
diff options
context:
space:
mode:
Diffstat (limited to 'data.go')
-rw-r--r--data.go3
1 files changed, 2 insertions, 1 deletions
diff --git a/data.go b/data.go
index 30f8a38..373dddb 100644
--- a/data.go
+++ b/data.go
@@ -92,6 +92,7 @@ func (store *SqlStore) PutScrobbles(scrobbles []Scrobble) error {
if err != nil {
return err
}
+
for _, s := range scrobbles {
_, err = st.Exec(s.Artist, s.AlbumArtist, s.TrackName, s.Album,
s.TrackNumber, s.Duration, s.Time, s.Chosen, s.Mbid, s.MbidComp,
@@ -115,6 +116,7 @@ func (store *SqlStore) RecentScrobbles(userId int) []*Scrobble {
if err != nil {
log.Println(err)
}
+ defer rows.Close()
for rows.Next() {
scrobble := new(Scrobble)
@@ -122,6 +124,5 @@ func (store *SqlStore) RecentScrobbles(userId int) []*Scrobble {
&scrobble.TrackName.Name, &scrobble.Time, &scrobble.Image)
scrobbles = append(scrobbles, scrobble)
}
- rows.Close()
return scrobbles
}