Skip to content

Commit 1ee96ae

Browse files
committed
Merge pull request #489 from zmack/default_role_to_master
Default role to master
2 parents 5abad37 + fff8b56 commit 1ee96ae

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,8 @@ and one or more slaves (`mymaster` in the example).
105105

106106
* It is possible to optionally provide a role. The allowed roles are `master`
107107
and `slave`. When the role is `slave`, the client will try to connect to a
108-
random slave of the specified master.
108+
random slave of the specified master. If a role is not specified, the client
109+
will connect to the master.
109110

110111
* When using the Sentinel support you need to specify a list of sentinels to
111112
connect to. The list does not need to enumerate all your Sentinel instances,

lib/redis/client.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -477,7 +477,7 @@ def initialize(options)
477477
super(options)
478478

479479
@sentinels = options.fetch(:sentinels).dup
480-
@role = options[:role].to_s
480+
@role = options.fetch(:role, "master").to_s
481481
@master = options[:host]
482482
end
483483

0 commit comments

Comments
 (0)