aboutsummaryrefslogtreecommitdiff
path: root/cmd
diff options
context:
space:
mode:
authorJamal Carvalho <jamal@golang.org>2022-01-06 21:13:10 +0000
committerJamal Carvalho <jamal@golang.org>2022-01-06 23:49:05 +0000
commitcf9e9d0dbb309851faec02cf2ca1fc9b28d0f694 (patch)
tree77a6ac87459bedfb820c05738a05f92b2805161b /cmd
parent46c69fbd4081c98528db2f73027e4c2c6b530f18 (diff)
downloadgo-x-pkgsite-cf9e9d0dbb309851faec02cf2ca1fc9b28d0f694.tar.xz
cmd,internal: add worker endpoint to clear beta cache
Added an endpoint to clear the cache during cloudbuild deployments of the beta frontend. Change-Id: I3fb19c3f1eef6b1b15eda2601b27a403b39b0f8d Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/375956 Trust: Jamal Carvalho <jamal@golang.org> Run-TryBot: Jamal Carvalho <jamal@golang.org> TryBot-Result: kokoro <noreply+kokoro@google.com> Reviewed-by: Jonathan Amsterdam <jba@google.com> Reviewed-by: Julie Qiu <julie@golang.org>
Diffstat (limited to 'cmd')
-rw-r--r--cmd/worker/main.go24
1 files changed, 15 insertions, 9 deletions
diff --git a/cmd/worker/main.go b/cmd/worker/main.go
index 6633a97e..64124961 100644
--- a/cmd/worker/main.go
+++ b/cmd/worker/main.go
@@ -92,17 +92,19 @@ func main() {
reportingClient := cmdconfig.ReportingClient(ctx, cfg)
redisCacheClient := getCacheRedis(ctx, cfg)
+ redisBetaCacheClient := getBetaCacheRedis(ctx, cfg)
experimenter := cmdconfig.Experimenter(ctx, cfg, expg, reportingClient)
server, err := worker.NewServer(cfg, worker.ServerConfig{
- DB: db,
- IndexClient: indexClient,
- ProxyClient: proxyClient,
- SourceClient: sourceClient,
- RedisCacheClient: redisCacheClient,
- Queue: fetchQueue,
- ReportingClient: reportingClient,
- StaticPath: template.TrustedSourceFromFlag(flag.Lookup("static").Value),
- GetExperiments: experimenter.Experiments,
+ DB: db,
+ IndexClient: indexClient,
+ ProxyClient: proxyClient,
+ SourceClient: sourceClient,
+ RedisCacheClient: redisCacheClient,
+ RedisBetaCacheClient: redisBetaCacheClient,
+ Queue: fetchQueue,
+ ReportingClient: reportingClient,
+ StaticPath: template.TrustedSourceFromFlag(flag.Lookup("static").Value),
+ GetExperiments: experimenter.Experiments,
})
if err != nil {
log.Fatal(ctx, err)
@@ -157,6 +159,10 @@ func getCacheRedis(ctx context.Context, cfg *config.Config) *redis.Client {
return getRedis(ctx, cfg.RedisCacheHost, cfg.RedisCachePort, 0, 6*time.Second)
}
+func getBetaCacheRedis(ctx context.Context, cfg *config.Config) *redis.Client {
+ return getRedis(ctx, cfg.RedisBetaCacheHost, cfg.RedisCachePort, 0, 6*time.Second)
+}
+
func getRedis(ctx context.Context, host, port string, writeTimeout, readTimeout time.Duration) *redis.Client {
if host == "" {
return nil