diff --git a/persist/sqlite/store.go b/persist/sqlite/store.go index ed04eecb..56b37d58 100644 --- a/persist/sqlite/store.go +++ b/persist/sqlite/store.go @@ -83,7 +83,7 @@ func (s *Store) queryRow(query string, args ...any) *loggedRow { func (s *Store) transaction(fn func(txn) error) error { var err error log := s.log.Named("transaction") - for i := 1; i <= 10; i++ { + for i := 1; i <= 15; i++ { start := time.Now() log := log.With(zap.Int("attempt", i)) err = doTransaction(s.db, log, fn) @@ -98,7 +98,7 @@ func (s *Store) transaction(fn func(txn) error) error { return err } log.Debug("database locked", zap.Duration("elapsed", time.Since(start)), zap.Stack("stack")) - sleep := time.Duration(math.Pow(2, float64(i))) * time.Millisecond + sleep := time.Duration(math.Pow(2, float64(i))) * time.Millisecond // exponential backoff for a total of ~30s time.Sleep(sleep + time.Duration(rand.Int63n(int64(sleep)/10))) } return fmt.Errorf("transaction failed: %w", err)