Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1226)

Unified Diff: tokenserver/appengine/impl/certchecker/warmup.go

Issue 2779323002: token-server: Warmup some local caches in /_ah/warmup. (Closed)
Patch Set: Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: tokenserver/appengine/impl/certchecker/warmup.go
diff --git a/tokenserver/appengine/impl/certchecker/warmup.go b/tokenserver/appengine/impl/certchecker/warmup.go
index 8307d0aaac1f54b3999501e45d7eaec2d50e7f3c..c31a1824f54e30333eda53c56c78a973d1f6ffea 100644
--- a/tokenserver/appengine/impl/certchecker/warmup.go
+++ b/tokenserver/appengine/impl/certchecker/warmup.go
@@ -7,12 +7,27 @@ package certchecker
import (
"golang.org/x/net/context"
+ "github.com/luci/luci-go/common/logging"
"github.com/luci/luci-go/server/warmup"
+ "github.com/luci/luci-go/tokenserver/appengine/impl/certconfig"
)
func init() {
warmup.Register("tokenserver/appengine/impl/certchecker", func(c context.Context) error {
- // TODO
+ names, err := certconfig.ListCAs(c)
+ if err != nil {
+ return err
+ }
+ for _, cn := range names {
+ logging.Infof(c, "Warming up %q", cn)
+ checker, err := GetCertChecker(c, cn)
+ if err == nil {
+ _, err = checker.GetCA(c)
+ }
+ if err != nil {
+ logging.WithError(err).Warningf(c, "Failed to warm up %q", cn)
nodir 2017/03/29 21:45:06 why it doesn't return err in this case but returns
Vadim Sh. 2017/03/29 21:49:30 Because we don't want to do "return err" here, bef
Vadim Sh. 2017/03/29 23:46:00 Added MultiError.
+ }
+ }
return nil
})
}
« no previous file with comments | « no previous file | tokenserver/appengine/impl/certconfig/ca.go » ('j') | tokenserver/appengine/impl/certconfig/ca.go » ('J')

Powered by Google App Engine
This is Rietveld 408576698