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

Unified Diff: impl/memory/taskqueue.go

Issue 1494223002: Add API to allow you to get the non-transactional datastore or taskqueue. (Closed) Base URL: https://github.com/luci/gae.git@master
Patch Set: fix doc and naming Created 5 years 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 | « impl/memory/datastore_test.go ('k') | impl/memory/taskqueue_test.go » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: impl/memory/taskqueue.go
diff --git a/impl/memory/taskqueue.go b/impl/memory/taskqueue.go
index 9ac3e5287d6b80ba66b140edee33f39d75a376ca..703c1057835d193adc2e263b4f25c84e56013d3c 100644
--- a/impl/memory/taskqueue.go
+++ b/impl/memory/taskqueue.go
@@ -18,20 +18,20 @@ import (
/////////////////////////////// public functions ///////////////////////////////
func useTQ(c context.Context) context.Context {
- return tq.SetRawFactory(c, func(ic context.Context) tq.RawInterface {
- tqd := cur(ic).Get(memContextTQIdx)
- if x, ok := tqd.(*taskQueueData); ok {
- return &taskqueueImpl{
- x,
- ic,
- curGID(ic).namespace,
- }
+ return tq.SetRawFactory(c, func(ic context.Context, wantTxn bool) tq.RawInterface {
+ ns := curGID(ic).namespace
+ var tqd memContextObj
+
+ if !wantTxn {
+ tqd = curNoTxn(ic).Get(memContextTQIdx)
+ } else {
+ tqd = cur(ic).Get(memContextTQIdx)
}
- return &taskqueueTxnImpl{
- tqd.(*txnTaskQueueData),
- ic,
- curGID(ic).namespace,
+
+ if x, ok := tqd.(*taskQueueData); ok {
+ return &taskqueueImpl{x, ic, ns}
}
+ return &taskqueueTxnImpl{tqd.(*txnTaskQueueData), ic, ns}
})
}
« no previous file with comments | « impl/memory/datastore_test.go ('k') | impl/memory/taskqueue_test.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698