1
0
mirror of https://github.com/go-micro/go-micro.git synced 2026-06-09 19:16:58 +02:00
Files
go-micro/util/pool/options.go
Ak-Army 0433e98dbc 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>
2024-07-23 12:19:43 +01:00

41 lines
572 B
Go

package pool
import (
"time"
"go-micro.dev/v5/transport"
)
type Options struct {
Transport transport.Transport
TTL time.Duration
CloseTimeout time.Duration
Size int
}
type Option func(*Options)
func Size(i int) Option {
return func(o *Options) {
o.Size = i
}
}
func Transport(t transport.Transport) Option {
return func(o *Options) {
o.Transport = t
}
}
func TTL(t time.Duration) Option {
return func(o *Options) {
o.TTL = t
}
}
func CloseTimeout(t time.Duration) Option {
return func(o *Options) {
o.CloseTimeout = t
}
}