diff --git a/dbpool.go b/dbpool.go index e989032..74ceb62 100644 --- a/dbpool.go +++ b/dbpool.go @@ -99,7 +99,6 @@ func (this *dbPool) SelectOne( func (this *dbPool) OrmSelectOne( dataSource string, tblName string, - fields []string, whereKv [][]string, cb QueryOneCb) { params := []string{} @@ -193,14 +192,15 @@ func (this *dbPool) borrowConn(name string) *dataSource { for tryCount < 5 { { this.lock.Lock() - defer this.lock.Unlock() if head, ok := this.dataSourceHash[name]; ok { if !head.Empty() { next := head.Next() next.Del() + this.lock.Unlock() return next.GetData().(*dataSource) } } + this.lock.Unlock() } time.Sleep(time.Second * 1) tryCount++