Index: impl/prod/context.go |
diff --git a/impl/prod/context.go b/impl/prod/context.go |
index 11bd6c24e33189a6c1e815b975a15ee2ff2c7b56..48238aa5925c8b3abf7eda4459b4d96ba2c5832f 100644 |
--- a/impl/prod/context.go |
+++ b/impl/prod/context.go |
@@ -14,8 +14,9 @@ import ( |
type key int |
var ( |
- prodContextKey key |
- probeCacheKey key = 1 |
+ prodContextKey key |
+ prodContextNoTxKey key = 1 |
+ probeCacheKey key = 2 |
) |
// AEContext retrieves the raw "google.golang.org/appengine" compatible Context. |
@@ -24,6 +25,12 @@ func AEContext(c context.Context) context.Context { |
return aeCtx |
} |
+// AEContextNoTX retrieves the raw "google.golang.org/appengine" compatible Context. |
Vadim Sh.
2015/12/04 03:22:04
document the difference between AEContextNoTX and
|
+func AEContextNoTX(c context.Context) context.Context { |
+ aeCtx, _ := c.Value(prodContextNoTxKey).(context.Context) |
+ return aeCtx |
+} |
+ |
// Use adds production implementations for all the gae services to the |
// context. |
// |
@@ -40,5 +47,6 @@ func AEContext(c context.Context) context.Context { |
func Use(c context.Context, r *http.Request) context.Context { |
aeCtx := appengine.NewContext(r) |
c = context.WithValue(c, prodContextKey, aeCtx) |
+ c = context.WithValue(c, prodContextNoTxKey, aeCtx) |
return useUser(useURLFetch(useRDS(useMC(useTQ(useGI(c)))))) |
} |