Skip to content

Commit 967e757

Browse files
authored
feat: remove Redis cluster node number check, it's redis client responsibility (#37)
1 parent 69ad23b commit 967e757

File tree

1 file changed

+4
-9
lines changed

1 file changed

+4
-9
lines changed

watcher.go

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -109,9 +109,8 @@ func (m *MSG) UnmarshalBinary(data []byte) error {
109109
// addr is a redis target string in the format "host:port"
110110
// setters allows for inline WatcherOptions
111111
//
112-
// Example:
113-
// w, err := rediswatcher.NewWatcher("127.0.0.1:6379",WatcherOptions{}, nil)
114-
//
112+
// Example:
113+
// w, err := rediswatcher.NewWatcher("127.0.0.1:6379",WatcherOptions{}, nil)
115114
func NewWatcher(addr string, option WatcherOptions) (persist.Watcher, error) {
116115
option.Options.Addr = addr
117116
initConfig(&option)
@@ -141,14 +140,10 @@ func NewWatcher(addr string, option WatcherOptions) (persist.Watcher, error) {
141140
// NewWatcherWithCluster creates a new Watcher to be used with a Casbin enforcer
142141
// addrs is a redis-cluster target string in the format "host1:port1,host2:port2,host3:port3"
143142
//
144-
// Example:
145-
// w, err := rediswatcher.NewWatcherWithCluster("127.0.0.1:6379,127.0.0.1:6379,127.0.0.1:6379",WatcherOptions{})
146-
//
143+
// Example:
144+
// w, err := rediswatcher.NewWatcherWithCluster("127.0.0.1:6379,127.0.0.1:6379,127.0.0.1:6379",WatcherOptions{})
147145
func NewWatcherWithCluster(addrs string, option WatcherOptions) (persist.Watcher, error) {
148146
addrsStr := strings.Split(addrs, ",")
149-
if len(addrsStr) < 3 {
150-
return nil, errors.New("nodes num must >= 3")
151-
}
152147
option.ClusterOptions.Addrs = addrsStr
153148
initConfig(&option)
154149

0 commit comments

Comments
 (0)