Fix bug with too many open connecitons
This commit is contained in:
@@ -34,6 +34,7 @@ func IsSaved(store *Store, url string) bool {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
|
defer query.Close()
|
||||||
|
|
||||||
row := query.QueryRow(url)
|
row := query.QueryRow(url)
|
||||||
err = row.Scan(&exists)
|
err = row.Scan(&exists)
|
||||||
@@ -52,6 +53,7 @@ func ArticlesForDay(store *Store, day time.Time) (articles []model.DisplayArticl
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return result, err
|
return result, err
|
||||||
}
|
}
|
||||||
|
defer query.Close()
|
||||||
|
|
||||||
tomorrow := day.AddDate(0, 0, 1)
|
tomorrow := day.AddDate(0, 0, 1)
|
||||||
todayDate := day.Format("2006-01-02")
|
todayDate := day.Format("2006-01-02")
|
||||||
@@ -98,6 +100,7 @@ func ArticleByID(store *Store, ID int, slug string) (article model.DisplayArticl
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return result, err
|
return result, err
|
||||||
}
|
}
|
||||||
|
defer query.Close()
|
||||||
|
|
||||||
row := query.QueryRow(ID, slug)
|
row := query.QueryRow(ID, slug)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|||||||
Reference in New Issue
Block a user