1
0
mirror of https://github.com/redis/go-redis.git synced 2025-07-18 00:20:57 +03:00

Ring instrumentantions (#1017)

* Ring instrumentantions
This commit is contained in:
Andrea Spacca
2019-04-24 08:33:36 +02:00
committed by Vladimir Mihailenco
parent 3227091087
commit 97e6ed8178
2 changed files with 30 additions and 1 deletions

View File

@ -361,7 +361,8 @@ func NewRing(opt *RingOptions) *Ring {
ring.process = ring.defaultProcess
ring.processPipeline = ring.defaultProcessPipeline
ring.cmdable.setProcessor(ring.Process)
ring.init()
for name, addr := range opt.Addrs {
clopt := opt.clientOptions()
@ -374,6 +375,10 @@ func NewRing(opt *RingOptions) *Ring {
return ring
}
func (c *Ring) init() {
c.cmdable.setProcessor(c.Process)
}
func (c *Ring) Context() context.Context {
if c.ctx != nil {
return c.ctx
@ -392,6 +397,8 @@ func (c *Ring) WithContext(ctx context.Context) *Ring {
func (c *Ring) clone() *Ring {
cp := *c
cp.init()
return &cp
}