Chromium Code Reviews| Index: appengine/gaemiddleware/context.go |
| diff --git a/appengine/gaemiddleware/context.go b/appengine/gaemiddleware/context.go |
| index d4215448f58a997c4e2efd5add2ab7e2c58e5c42..f55e232f2e0511736bff7bb52cf100a19497c6c3 100644 |
| --- a/appengine/gaemiddleware/context.go |
| +++ b/appengine/gaemiddleware/context.go |
| @@ -17,6 +17,7 @@ import ( |
| "github.com/luci/luci-go/common/config" |
| "github.com/luci/luci-go/common/data/caching/cacheContext" |
| "github.com/luci/luci-go/common/data/caching/proccache" |
| + "github.com/luci/luci-go/common/data/rand/mathrand" |
| "github.com/luci/luci-go/common/logging" |
| "github.com/luci/luci-go/server/auth" |
| @@ -61,10 +62,14 @@ var ( |
| // globalTsMonState holds state related to time series monitoring. |
| globalTsMonState = &tsmon.State{} |
| + |
| + // globalMathRand is a global "math/rand" instance. |
|
Vadim Sh.
2016/12/20 00:56:37
actually, nit: add a comment stating that this obj
dnj
2016/12/20 00:58:48
Done.
|
| + globalMathRand = mathrand.Get(context.Background()) |
| ) |
| // WithProd installs the set of standard production AppEngine services: |
| // * github.com/luci/luci-go/common/logging (set default level to debug). |
| +// * github.com/luci/luci-go/common/data/rand/mathrand. |
| // * github.com/luci/gae/impl/prod (production appengine services) |
| // * github.com/luci/luci-go/appengine/gaeauth/client (appengine urlfetch transport) |
| // * github.com/luci/luci-go/server/proccache (in process memory cache) |
| @@ -75,6 +80,7 @@ var ( |
| func WithProd(c context.Context, req *http.Request) context.Context { |
| // These are needed to use fetchCachedSettings. |
| c = logging.SetLevel(c, logging.Debug) |
| + c = mathrand.SetRand(c, globalMathRand) |
| c = prod.Use(c, req) |
| c = settings.Use(c, globalSettings) |