Skip to content

Commit 42adf30

Browse files
committed
Actually fix sentinel when using authentication.
1 parent f2a604e commit 42adf30

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

lib/redis/client.rb

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -366,6 +366,8 @@ def ensure_connected
366366
end
367367

368368
def _parse_options(options)
369+
return options if options[:_parsed]
370+
369371
defaults = DEFAULTS.dup
370372
options = options.dup
371373

@@ -450,6 +452,8 @@ def _parse_options(options)
450452
end
451453
end
452454

455+
options[:_parsed] = true
456+
453457
options
454458
end
455459

@@ -485,6 +489,7 @@ def initialize(options)
485489
super(options)
486490

487491
@sentinels = @options.delete(:sentinels).dup
492+
@options.delete(:password)
488493
@role = @options.fetch(:role, "master").to_s
489494
@master = @options[:host]
490495
end

test/sentinel_test.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,10 @@ def test_sentinel_with_auth
119119
}
120120

121121
sentinel = {
122+
:auth => lambda do |pass|
123+
commands[:s1] << ["auth", pass]
124+
"-ERR unknown command 'auth'"
125+
end,
122126
:sentinel => lambda do |command, *args|
123127
commands[:s1] << [command, *args]
124128
["127.0.0.1", "6382"]

0 commit comments

Comments
 (0)