mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-05-06 09:50:23 +02:00
kvdb/sqlbase: fix params used in randRetryDelay
This commit is contained in:
parent
f7cb44382e
commit
08f4940e88
@ -234,7 +234,9 @@ func (db *db) Update(f func(tx walletdb.ReadWriteTx) error,
|
||||
|
||||
// randRetryDelay returns a random retry delay between -50% and +50% of the
|
||||
// configured delay that is doubled for each attempt and capped at a max value.
|
||||
func randRetryDelay(initialRetryDelay, maxRetryDelay, attempt int) time.Duration {
|
||||
func randRetryDelay(initialRetryDelay, maxRetryDelay time.Duration,
|
||||
attempt int) time.Duration {
|
||||
|
||||
halfDelay := initialRetryDelay / 2
|
||||
randDelay := prand.Int63n(int64(initialRetryDelay)) //nolint:gosec
|
||||
|
||||
@ -273,8 +275,8 @@ func (db *db) executeTransaction(f func(tx walletdb.ReadWriteTx) error,
|
||||
// should abort the retries.
|
||||
waitBeforeRetry := func(attemptNumber int) bool {
|
||||
retryDelay := randRetryDelay(
|
||||
attemptNumber, DefaultInitialRetryDelay,
|
||||
DefaultMaxRetryDelay,
|
||||
DefaultInitialRetryDelay, DefaultMaxRetryDelay,
|
||||
attemptNumber,
|
||||
)
|
||||
|
||||
log.Debugf("Retrying transaction due to tx serialization "+
|
||||
|
Loading…
x
Reference in New Issue
Block a user