Skip to content

Commit 1b017fe

Browse files
authored
Fix setting redis db path (#15698)
There is a bug setting the redis db in the common nosql manager whereby the db path always fails. This PR fixes this. Signed-off-by: Andrew Thornton <[email protected]>
1 parent d11b9fb commit 1b017fe

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

modules/nosql/manager_redis.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ func (m *Manager) GetRedisClient(connection string) redis.UniversalClient {
152152
opts.Addrs = append(opts.Addrs, strings.Split(uri.Host, ",")...)
153153
}
154154
if uri.Path != "" {
155-
if db, err := strconv.Atoi(uri.Path); err == nil {
155+
if db, err := strconv.Atoi(uri.Path[1:]); err == nil {
156156
opts.DB = db
157157
}
158158
}
@@ -168,7 +168,7 @@ func (m *Manager) GetRedisClient(connection string) redis.UniversalClient {
168168
opts.Addrs = append(opts.Addrs, strings.Split(uri.Host, ",")...)
169169
}
170170
if uri.Path != "" {
171-
if db, err := strconv.Atoi(uri.Path); err == nil {
171+
if db, err := strconv.Atoi(uri.Path[1:]); err == nil {
172172
opts.DB = db
173173
}
174174
}
@@ -186,7 +186,7 @@ func (m *Manager) GetRedisClient(connection string) redis.UniversalClient {
186186
opts.Addrs = append(opts.Addrs, strings.Split(uri.Host, ",")...)
187187
}
188188
if uri.Path != "" {
189-
if db, err := strconv.Atoi(uri.Path); err == nil {
189+
if db, err := strconv.Atoi(uri.Path[1:]); err == nil {
190190
opts.DB = db
191191
}
192192
}

0 commit comments

Comments
 (0)