1
0
mirror of https://github.com/redis/go-redis.git synced 2025-07-29 17:41:15 +03:00

Rework Options initialisation.

This commit is contained in:
Vladimir Mihailenco
2016-06-05 11:10:30 +00:00
parent 08d3790ec5
commit 079b7ce393
5 changed files with 34 additions and 51 deletions

View File

@ -64,12 +64,15 @@ func (opt *FailoverOptions) options() *Options {
// goroutines.
func NewFailoverClient(failoverOpt *FailoverOptions) *Client {
opt := failoverOpt.options()
opt.init()
failover := &sentinelFailover{
masterName: failoverOpt.MasterName,
sentinelAddrs: failoverOpt.SentinelAddrs,
opt: opt,
}
client := Client{
baseClient: baseClient{
opt: opt,
@ -81,6 +84,7 @@ func NewFailoverClient(failoverOpt *FailoverOptions) *Client {
},
}
client.cmdable.process = client.Process
return &client
}
@ -92,6 +96,7 @@ type sentinelClient struct {
}
func newSentinel(opt *Options) *sentinelClient {
opt.init()
client := sentinelClient{
baseClient: baseClient{
opt: opt,