seefan / gossdb

ssdb client for go with pool surport
MIT License
131 stars 47 forks source link

协程过多导致内存cpu过高 #43

Closed changtsing closed 6 years ago

changtsing commented 6 years ago

初始化链接池失败时会一直开协程导致服务的内存和cpu暴涨 NewPool() -> Start() -> go watch()-> Start() ->go watch() 。。。。。。 会一直重复 start()函数。 以下我个人修改方法, func (p Pool) Start() error { p.defaultConfig() p.poolWait = make(chan PooledClient, p.MaxWaitSize) p.waitCount = 0 p.pooled.Init(p.AcquireIncrement, p.MinPoolSize, p.MaxPoolSize, p) p.pooled.Append(p.MinPoolSize) if p.Status == PoolInit {//只是首次执行 否则会内存泄露 p.Status = PoolStart p.watcher = time.NewTicker(time.Second * time.Duration(p.HealthSecond)) go p.watch() } return nil }

seefan commented 6 years ago

已修复