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

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

Issue 2779323002: token-server: Warmup some local caches in /_ah/warmup. (Closed)
Patch Set: also warmup delegation config 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
« no previous file with comments | « no previous file | tokenserver/appengine/impl/certconfig/ca.go » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..713b298249f1b8d091f97e12606d8c2103064c96 100644
--- a/tokenserver/appengine/impl/certchecker/warmup.go
+++ b/tokenserver/appengine/impl/certchecker/warmup.go
@@ -7,12 +7,33 @@ package certchecker
import (
"golang.org/x/net/context"
+ "github.com/luci/luci-go/common/errors"
+ "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
- return nil
+ names, err := certconfig.ListCAs(c)
+ if err != nil {
+ return err
+ }
+ var merr errors.MultiError
+ 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)
+ merr = append(merr, err)
+ }
+ }
+ if len(merr) == 0 {
+ return nil
+ }
+ return merr
})
}
« no previous file with comments | « no previous file | tokenserver/appengine/impl/certconfig/ca.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698