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(
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++