This commit is contained in:
aozhiwei 2024-06-27 11:10:28 +08:00
parent 1333e005d3
commit 717e9616ae

View File

@ -405,7 +405,7 @@ func (this *dbPool) borrowConn(name string) *dataSource {
if head, ok := this.dataSourceHash[name]; ok {
if !head.Empty() {
ds := head.FirstEntry().(*dataSource)
ds.entry.DelInit()
//ds.entry.DelInit()
this.lock.Unlock()
return ds
}
@ -416,17 +416,37 @@ func (this *dbPool) borrowConn(name string) *dataSource {
tryCount++
}
return nil
/*
tryCount := 0
for tryCount < 5 {
{
this.lock.Lock()
if head, ok := this.dataSourceHash[name]; ok {
if !head.Empty() {
ds := head.FirstEntry().(*dataSource)
ds.entry.DelInit()
this.lock.Unlock()
return ds
}
}
this.lock.Unlock()
}
time.Sleep(time.Second * 1)
tryCount++
}
return nil*/
}
func (this *dbPool) returnConn(ds *dataSource) {
this.lock.Lock()
defer this.lock.Unlock()
/*
if head, ok := this.dataSourceHash[ds.name]; ok {
head.AddTail(&ds.entry)
} else {
panic(fmt.Sprintf("returnConn error %s", ds.name))
}
}*/
}
func (this *dbPool) joinSelectFields(fields []string) string {