This commit is contained in:
aozhiwei 2023-08-20 18:41:07 +08:00
parent 7dd2331f6c
commit 1a8c40f038

View File

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