Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow passing *redis.Client when create Watcher #9

Closed
wants to merge 1 commit into from

Conversation

binhnguyenduc
Copy link

@binhnguyenduc binhnguyenduc commented Jun 9, 2021

Fix: #13

The current default implementation create a new redis.Client based on the Addr. This limits the options when it comes to which redis Client to use, i.e. will not be able to use redis.FailoverClient in Sentinel mode.

I made a small change to allow caller to pass in already initialized redis.Client to the Watcher.

… is to allow more flexibility when choosing redis client to used with Watcher, as the default option does not allow using RedisFailoverClient (Sentinel, for example

Signed-off-by: Binh Nguyen <binh.d.nguyen165@gmail.com>
@hsluoyz
Copy link
Member

hsluoyz commented Jun 10, 2021

@binhnguyenduc hi, please fix:

image

Copy link
Collaborator

@kilosonc kilosonc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

plz fix below

Comment on lines +61 to +71
if option.SubClient != nil {
w.subClient = option.SubClient
} else {
w.subClient = rds.NewClient(&option.Options)
}
if option.PubClient != nil {
w.pubClient = option.PubClient
} else {
w.pubClient = rds.NewClient(&option.Options)
}

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

plz move this part into initConfig, and format the code

@hsluoyz
Copy link
Member

hsluoyz commented Jul 5, 2021

Replaced by: #15

@hsluoyz hsluoyz closed this Jul 5, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Allow passing *redis.Client when create Watcher
3 participants