1
This commit is contained in:
parent
1333e005d3
commit
717e9616ae
24
dbpool.go
24
dbpool.go
@ -405,7 +405,7 @@ func (this *dbPool) borrowConn(name string) *dataSource {
|
|||||||
if head, ok := this.dataSourceHash[name]; ok {
|
if head, ok := this.dataSourceHash[name]; ok {
|
||||||
if !head.Empty() {
|
if !head.Empty() {
|
||||||
ds := head.FirstEntry().(*dataSource)
|
ds := head.FirstEntry().(*dataSource)
|
||||||
ds.entry.DelInit()
|
//ds.entry.DelInit()
|
||||||
this.lock.Unlock()
|
this.lock.Unlock()
|
||||||
return ds
|
return ds
|
||||||
}
|
}
|
||||||
@ -416,17 +416,37 @@ func (this *dbPool) borrowConn(name string) *dataSource {
|
|||||||
tryCount++
|
tryCount++
|
||||||
}
|
}
|
||||||
return nil
|
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) {
|
func (this *dbPool) returnConn(ds *dataSource) {
|
||||||
this.lock.Lock()
|
this.lock.Lock()
|
||||||
defer this.lock.Unlock()
|
defer this.lock.Unlock()
|
||||||
|
|
||||||
|
/*
|
||||||
if head, ok := this.dataSourceHash[ds.name]; ok {
|
if head, ok := this.dataSourceHash[ds.name]; ok {
|
||||||
head.AddTail(&ds.entry)
|
head.AddTail(&ds.entry)
|
||||||
} else {
|
} else {
|
||||||
panic(fmt.Sprintf("returnConn error %s", ds.name))
|
panic(fmt.Sprintf("returnConn error %s", ds.name))
|
||||||
}
|
}*/
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this *dbPool) joinSelectFields(fields []string) string {
|
func (this *dbPool) joinSelectFields(fields []string) string {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user