fixup redis broker
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
This commit is contained in:
parent
13a4527f83
commit
002a038413
24
redis.go
24
redis.go
@ -244,28 +244,24 @@ func (b *Broker) Subscribe(ctx context.Context, topic string, handler broker.Han
|
|||||||
func (b *Broker) configure() error {
|
func (b *Broker) configure() error {
|
||||||
redisOptions := DefaultOptions
|
redisOptions := DefaultOptions
|
||||||
|
|
||||||
if b.cli != nil && b.opts.Context == nil {
|
if b.opts.Context != nil {
|
||||||
return nil
|
if c, ok := b.opts.Context.Value(configKey{}).(*redis.UniversalOptions); ok && c != nil {
|
||||||
|
redisOptions = c
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if b.opts.Context != nil {
|
if len(b.opts.Addrs) > 0 {
|
||||||
if c, ok := b.opts.Context.Value(configKey{}).(*redis.UniversalOptions); ok {
|
redisOptions.Addrs = b.opts.Addrs
|
||||||
redisOptions = c
|
}
|
||||||
if b.opts.TLSConfig != nil {
|
|
||||||
redisOptions.TLSConfig = b.opts.TLSConfig
|
if b.opts.TLSConfig != nil {
|
||||||
}
|
redisOptions.TLSConfig = b.opts.TLSConfig
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if redisOptions == nil && b.cli != nil {
|
if redisOptions == nil && b.cli != nil {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
if redisOptions == nil {
|
|
||||||
redisOptions.Addrs = b.opts.Addrs
|
|
||||||
redisOptions.TLSConfig = b.opts.TLSConfig
|
|
||||||
}
|
|
||||||
|
|
||||||
c := redis.NewUniversalClient(redisOptions)
|
c := redis.NewUniversalClient(redisOptions)
|
||||||
setTracing(c, b.opts.Tracer)
|
setTracing(c, b.opts.Tracer)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user