mirror of
https://github.com/astaxie/beego.git
synced 2024-11-22 07:10:55 +00:00
Fix 4059
This commit is contained in:
parent
9dc660c1da
commit
c08b27111c
@ -425,7 +425,6 @@ func GetDB(aliasNames ...string) (*sql.DB, error) {
|
|||||||
|
|
||||||
type stmtDecorator struct {
|
type stmtDecorator struct {
|
||||||
wg sync.WaitGroup
|
wg sync.WaitGroup
|
||||||
lastUse int64
|
|
||||||
stmt *sql.Stmt
|
stmt *sql.Stmt
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -433,9 +432,12 @@ func (s *stmtDecorator) getStmt() *sql.Stmt {
|
|||||||
return s.stmt
|
return s.stmt
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// acquire will add one
|
||||||
|
// since this method will be used inside read lock scope,
|
||||||
|
// so we can not do more things here
|
||||||
|
// we should think about refactor this
|
||||||
func (s *stmtDecorator) acquire() {
|
func (s *stmtDecorator) acquire() {
|
||||||
s.wg.Add(1)
|
s.wg.Add(1)
|
||||||
s.lastUse = time.Now().Unix()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *stmtDecorator) release() {
|
func (s *stmtDecorator) release() {
|
||||||
@ -453,7 +455,6 @@ func (s *stmtDecorator) destroy() {
|
|||||||
func newStmtDecorator(sqlStmt *sql.Stmt) *stmtDecorator {
|
func newStmtDecorator(sqlStmt *sql.Stmt) *stmtDecorator {
|
||||||
return &stmtDecorator{
|
return &stmtDecorator{
|
||||||
stmt: sqlStmt,
|
stmt: sqlStmt,
|
||||||
lastUse: time.Now().Unix(),
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user