aboutsummaryrefslogtreecommitdiff
path: root/internal/database/database.go
diff options
context:
space:
mode:
authorHana Kim <hyangah@gmail.com>2026-03-11 17:35:38 -0400
committerHyang-Ah Hana Kim <hyangah@gmail.com>2026-03-12 08:21:08 -0700
commite1e0df70af37f136110777d7b7af409f4201b925 (patch)
treed830f13d50dcd4e96caca7090276661f02559667 /internal/database/database.go
parent194e570e21c1dedb0321266981abb82e27cb00dd (diff)
downloadgo-x-pkgsite-e1e0df70af37f136110777d7b7af409f4201b925.tar.xz
devtools/cmd/seeddb, internal/database: reduce contention and increase retries
Lower the concurrency limit of seeddb from 10 to 5 to reduce database contention. Increase the maximum number of transaction retries on serialization failure from 10 to 20 to improve reliability for large module insertions. Change-Id: Id57eea3bf7b7cf5554d4e99fbe68ac89bb355904 Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/754540 kokoro-CI: kokoro <noreply+kokoro@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Ethan Lee <ethanalee@google.com>
Diffstat (limited to 'internal/database/database.go')
-rw-r--r--internal/database/database.go2
1 files changed, 1 insertions, 1 deletions
diff --git a/internal/database/database.go b/internal/database/database.go
index bcb7c09a..5fd3af9e 100644
--- a/internal/database/database.go
+++ b/internal/database/database.go
@@ -246,7 +246,7 @@ func (db *DB) transactWithRetry(ctx context.Context, opts *sql.TxOptions, txFunc
defer derrors.Wrap(&err, "transactWithRetry(%v)", opts)
// Retry on serialization failure, up to some max.
// See https://www.postgresql.org/docs/11/transaction-iso.html.
- const maxRetries = 10
+ const maxRetries = 20
sleepDur := 125 * time.Millisecond
for i := 0; i <= maxRetries; i++ {
err = db.transact(ctx, opts, txFunc)