pool icon indicating copy to clipboard operation
pool copied to clipboard

add check connection count

Open xinliangnote opened this issue 6 years ago • 0 comments

  1. 当初始化的链接都超过了空闲时间,当 pool.Get 时,会重新创建一个链接并返回。 针对这个问题,新增了一个方法,在 NewGRPCPool 方法中调用,每隔 10s 中,维护一下连接池数量。
//check connection count
go pool.CheckGRPCPool()
  1. 当初始化的链接数超过 MaxCap,比如做压测的时候。 针对这个问题,新增了一个判断,当 c.IdleCount() >= MaxCap 时,会返回一个 Error。

  2. pool.Get 时,新增一个判断:

if wrapConn.conn.GetState() != connectivity.Ready {
	c.close(wrapConn.conn)
	continue
}

xinliangnote avatar Oct 29 '19 03:10 xinliangnote