diff --git a/dbpool.go b/dbpool.go index 2a00823..b1a6518 100644 --- a/dbpool.go +++ b/dbpool.go @@ -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 {