Refactor session close as xorm already does everything needed internally (#2020)

This commit is contained in:
Lauris BH 2017-06-21 03:57:05 +03:00 committed by Lunny Xiao
parent 754482bf5d
commit 6db387a21e
23 changed files with 60 additions and 74 deletions

View file

@ -48,7 +48,7 @@ func (a *Attachment) AfterSet(colName string, _ xorm.Cell) {
// IncreaseDownloadCount is update download count + 1
func (a *Attachment) IncreaseDownloadCount() error {
sess := x.NewSession()
defer sessionRelease(sess)
defer sess.Close()
// Update download count.
if _, err := sess.Exec("UPDATE `attachment` SET download_count=download_count+1 WHERE id=?", a.ID); err != nil {