1
0
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:
Ak-Army
2024-07-23 13:19:43 +02:00
committed by GitHub
parent 1c6c1ff1a3
commit 0433e98dbc
6 changed files with 103 additions and 43 deletions

View File

@ -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