aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAleksandr Nogikh <nogikh@google.com>2023-02-02 17:08:59 +0100
committerAleksandr Nogikh <wp32pw@gmail.com>2023-02-03 10:39:13 +0100
commit64e439a66cef0360b60cb6d3fcd65395ebc28375 (patch)
treedc81a3861c32e6c45da57304e9e493aaa7728775
parent33fc5c09b6372f736ae49edac089ca9c413b28ce (diff)
dashboard: prevent contention on mass crash update
Without sleeping there's a big risk of getting an `API error 2 (datastore_v3: CONCURRENT_TRANSACTION): too much contention on these datastore entities. please try again.` error.
-rw-r--r--dashboard/app/asset_storage.go6
1 files changed, 6 insertions, 0 deletions
diff --git a/dashboard/app/asset_storage.go b/dashboard/app/asset_storage.go
index fba449223..a8492a3e8 100644
--- a/dashboard/app/asset_storage.go
+++ b/dashboard/app/asset_storage.go
@@ -414,6 +414,12 @@ func (ad *crashAssetDeprecator) batchProcessCrashes(count int) error {
toDelete = append(toDelete, asset.DownloadURL)
}
}
+ if i > 0 {
+ // Sleep for one second to prevent the "API error 2 (datastore_v3:
+ // CONCURRENT_TRANSACTION): too much contention on these datastore
+ // entities. please try again." error.
+ time.Sleep(time.Second)
+ }
err := ad.updateCrash(crashKeys[i], toDelete)
if err != nil {
return err