From 37c6ee51f404e2e36aae79afabda0620dcf55cbd Mon Sep 17 00:00:00 2001 From: Emma Lefavor Date: Thu, 11 Feb 2021 11:00:29 -0500 Subject: [PATCH] Update redis lock connection string parsing. (#656) --- v1/locks/redis/redis.go | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/v1/locks/redis/redis.go b/v1/locks/redis/redis.go index aaa5a188e..d434874ba 100644 --- a/v1/locks/redis/redis.go +++ b/v1/locks/redis/redis.go @@ -28,11 +28,10 @@ func New(cnf *config.Config, addrs []string, db, retries int) Lock { var password string - i := strings.LastIndex(addrs[0], "@") - if i > 0 { - // with passwrod - password = addrs[0][i+1:] - addrs[0] = addrs[0][:i] + parts := strings.Split(addrs[0], "@") + if len(parts) == 2 { + password = parts[0] + addrs[0] = parts[1] } ropt := &redis.UniversalOptions{