Browse Source

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 <art27@cantab.net>
pull/15710/head
zeripath 2 weeks ago
committed by GitHub
parent
commit
1b017fe7ca
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 3 deletions
  1. +3
    -3
      modules/nosql/manager_redis.go

+ 3
- 3
modules/nosql/manager_redis.go View File

@ -152,7 +152,7 @@ func (m *Manager) GetRedisClient(connection string) redis.UniversalClient {
opts.Addrs = append(opts.Addrs, strings.Split(uri.Host, ",")...)
}
if uri.Path != "" {
if db, err := strconv.Atoi(uri.Path); err == nil {
if db, err := strconv.Atoi(uri.Path[1:]); err == nil {
opts.DB = db
}
}
@ -168,7 +168,7 @@ func (m *Manager) GetRedisClient(connection string) redis.UniversalClient {
opts.Addrs = append(opts.Addrs, strings.Split(uri.Host, ",")...)
}
if uri.Path != "" {
if db, err := strconv.Atoi(uri.Path); err == nil {
if db, err := strconv.Atoi(uri.Path[1:]); err == nil {
opts.DB = db
}
}
@ -186,7 +186,7 @@ func (m *Manager) GetRedisClient(connection string) redis.UniversalClient {
opts.Addrs = append(opts.Addrs, strings.Split(uri.Host, ",")...)
}
if uri.Path != "" {
if db, err := strconv.Atoi(uri.Path); err == nil {
if db, err := strconv.Atoi(uri.Path[1:]); err == nil {
opts.DB = db
}
}


Loading…
Cancel
Save