mirror of
https://github.com/go-micro/go-micro.git
synced 2025-06-30 22:33:49 +02:00
Better connection pool handling (#2725)
* [fix] etcd config source prefix issue (#2389) * http transport data race issue (#2436) * [fix] #2431 http transport data race issue * [feature] Ability to close connection while receiving. Ability to send messages while receiving. Icreased r channel limit to 100 to more fluently communication. Do not dropp sent request if r channel is full. * [fix] Use pool connection close timeout * [fix] replace Close with private function * [fix] Do not close the transport client twice in stream connection , the transport client is closed in the rpc codec * [fix] tests --------- Co-authored-by: Johnson C <chengqiaosheng@gmail.com>
This commit is contained in:
@ -46,6 +46,7 @@ func newRPCClient(opt ...Option) Client {
|
||||
pool.Size(opts.PoolSize),
|
||||
pool.TTL(opts.PoolTTL),
|
||||
pool.Transport(opts.Transport),
|
||||
pool.CloseTimeout(opts.PoolCloseTimeout),
|
||||
)
|
||||
|
||||
rc := &rpcClient{
|
||||
@ -148,7 +149,10 @@ func (r *rpcClient) call(
|
||||
|
||||
c, err := r.pool.Get(address, dOpts...)
|
||||
if err != nil {
|
||||
return merrors.InternalServerError("go.micro.client", "connection error: %v", err)
|
||||
if c == nil {
|
||||
return merrors.InternalServerError("go.micro.client", "connection error: %v", err)
|
||||
}
|
||||
logger.Log(log.ErrorLevel, "failed to close pool", err)
|
||||
}
|
||||
|
||||
seq := atomic.AddUint64(&r.seq, 1) - 1
|
||||
|
Reference in New Issue
Block a user