Index: go/src/infra/gae/libs/wrapper/memory/context.go |
diff --git a/go/src/infra/gae/libs/wrapper/memory/context.go b/go/src/infra/gae/libs/wrapper/memory/context.go |
index 241d2a24edc1b09019731be9cb17c83c60b70005..b6607fcc4d0231f8b23874083be039c09a157545 100644 |
--- a/go/src/infra/gae/libs/wrapper/memory/context.go |
+++ b/go/src/infra/gae/libs/wrapper/memory/context.go |
@@ -6,8 +6,6 @@ package memory |
import ( |
"errors" |
- "infra/gae/libs/wrapper" |
- "math/rand" |
"sync" |
"golang.org/x/net/context" |
@@ -18,7 +16,7 @@ import ( |
type memContextObj interface { |
sync.Locker |
canApplyTxn(m memContextObj) bool |
- applyTxn(rnd *rand.Rand, m memContextObj) |
+ applyTxn(c context.Context, m memContextObj) |
endTxn() |
mkTxn(*datastore.TransactionOptions) (memContextObj, error) |
@@ -86,10 +84,10 @@ func (m memContext) canApplyTxn(txnCtxObj memContextObj) bool { |
return true |
} |
-func (m memContext) applyTxn(rnd *rand.Rand, txnCtxObj memContextObj) { |
+func (m memContext) applyTxn(c context.Context, txnCtxObj memContextObj) { |
txnCtx := txnCtxObj.(memContext) |
for i := range m { |
- m[i].applyTxn(rnd, txnCtx[i]) |
+ m[i].applyTxn(c, txnCtx[i]) |
} |
} |
@@ -162,7 +160,7 @@ func (d *dsImpl) RunInTransaction(f func(context.Context) error, o *datastore.Tr |
defer txnMC.Unlock() |
if curMC.canApplyTxn(txnMC) { |
- curMC.applyTxn(wrapper.GetMathRand(d.c), txnMC) |
+ curMC.applyTxn(d.c, txnMC) |
} else { |
return datastore.ErrConcurrentTransaction |
} |