cmd/frontend: fix variable shadowing of redisClient
Following CL 514518, the redisClient is always nil, due to a variable
shadowing bug. This led to a production outage (golang/go#62210), which
was not caught because the staging environment (where push tests run)
was not configured to enforce quota.
For starters, fix the variable shadowing bug. I looked into adding a
failing test, but it seemed intractible without a major refactoring.
Change-Id: I0492b2ece49759ebcae397c6600080fc44658f2b
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/521835
Run-TryBot: Robert Findley <rfindley@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
kokoro-CI: kokoro <noreply+kokoro@google.com>
Reviewed-by: Jamal Carvalho <jamal@golang.org>
diff --git a/cmd/frontend/main.go b/cmd/frontend/main.go
index 145f493..f931d85 100644
--- a/cmd/frontend/main.go
+++ b/cmd/frontend/main.go
@@ -143,7 +143,7 @@
var cacher frontend.Cacher
if cfg.RedisCacheHost != "" {
addr := cfg.RedisCacheHost + ":" + cfg.RedisCachePort
- redisClient := redis.NewClient(&redis.Options{Addr: addr})
+ redisClient = redis.NewClient(&redis.Options{Addr: addr})
if err := redisClient.Ping(ctx).Err(); err != nil {
log.Errorf(ctx, "redis at %s: %v", addr, err)
} else {