Skip to content

Commit

Permalink
refactor(liquidator.go): improve calculation of newSleepBetweenRetrie…
Browse files Browse the repository at this point in the history
…s to use milliseconds instead of seconds for more precise backoff timing
  • Loading branch information
markettes committed Apr 2, 2024
1 parent c4744ba commit 0ddd649
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions liquidator.go
Original file line number Diff line number Diff line change
Expand Up @@ -719,8 +719,8 @@ func performReverseSwap(info ManageChannelLiquidityInfo, channel *lnrpc.Channel,
if limitSwapAmount < float64(swapAmount)*backoffCoefficient {
time.Sleep(sleepBetweenRetries)
newSwapAmount := int64(float64(swapAmount) * backoffCoefficient)
newSecondsAmount := sleepBetweenRetries.Seconds() * sleepBetweenRetriesBackoff
newSleepBetweenRetries := time.Duration(newSecondsAmount) * time.Second
newMsAmount := float64((sleepBetweenRetries.Milliseconds())) * sleepBetweenRetriesBackoff
newSleepBetweenRetries := time.Duration(newMsAmount) * time.Millisecond
if newSleepBetweenRetries > sleepMax {
newSleepBetweenRetries = sleepMax
}
Expand Down

0 comments on commit 0ddd649

Please sign in to comment.