Fix bug with too many open connecitons

This commit is contained in:
Senad Uka
2022-02-15 04:30:31 +01:00
parent 33fe5b8a6a
commit 7cb3620040
2 changed files with 3 additions and 0 deletions

View File

@@ -34,6 +34,7 @@ func IsSaved(store *Store, url string) bool {
if err != nil {
panic(err)
}
defer query.Close()
row := query.QueryRow(url)
err = row.Scan(&exists)
@@ -52,6 +53,7 @@ func ArticlesForDay(store *Store, day time.Time) (articles []model.DisplayArticl
if err != nil {
return result, err
}
defer query.Close()
tomorrow := day.AddDate(0, 0, 1)
todayDate := day.Format("2006-01-02")
@@ -98,6 +100,7 @@ func ArticleByID(store *Store, ID int, slug string) (article model.DisplayArticl
if err != nil {
return result, err
}
defer query.Close()
row := query.QueryRow(ID, slug)
if err != nil {

BIN
server

Binary file not shown.