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

Unified Diff: impl/memory/datastore.go

Issue 1335083002: Add emulation of transaction retries to memory impl of RunInTransaction. (Closed) Base URL: https://github.com/luci/gae.git@master
Patch Set: behave identically to prod retry logic Created 5 years, 3 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
Index: impl/memory/datastore.go
diff --git a/impl/memory/datastore.go b/impl/memory/datastore.go
index 079c05dfde4b6fab38a79e3d8e40ecb4b4f9b6bd..d622e8199a0bf32f41937eb4f81a391e9037746a 100644
--- a/impl/memory/datastore.go
+++ b/impl/memory/datastore.go
@@ -24,7 +24,7 @@ func useRDS(c context.Context) context.Context {
ns := curGID(ic).namespace
if x, ok := dsd.(*dataStoreData); ok {
- return &dsImpl{x, ns, ic}
+ return &dsImpl{x, ns, 0, ic}
}
return &txnDsImpl{dsd.(*txnDataStoreData), ns}
})
@@ -34,9 +34,10 @@ func useRDS(c context.Context) context.Context {
// dsImpl exists solely to bind the current c to the datastore data.
type dsImpl struct {
- data *dataStoreData
- ns string
- c context.Context
+ data *dataStoreData
+ ns string
+ txnFakeRetry int
+ c context.Context
}
var _ ds.RawInterface = (*dsImpl)(nil)
@@ -107,6 +108,10 @@ func (d *dsImpl) CatchupIndexes() {
d.data.catchupIndexes()
}
+func (d *dsImpl) SetTransactionRetryCount(count int) {
+ d.txnFakeRetry = count
+}
+
func (d *dsImpl) Testable() ds.Testable {
return d
}

Powered by Google App Engine
This is Rietveld 408576698