-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Sleep time between retries #73
Conversation
…CLI tool and its requirements, build & test instructions, dev environment setup, and exposed metrics feat(flags.go): add flags for sleepBetweenRetries, sleepBetweenRetriesBackoff, and sleepMax to allow configuring sleep intervals and backoff for retries refactor(liquidator.go): refactor variable declarations for better readability and add new variables for sleep intervals and backoff
…Swap and performReverseSwap functions to introduce delay between retries for better error handling and backoff strategy
…t it to sleepMax value for better performance and consistency
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM.
I won't override new flags as default values sounds like very good first pattern to check.
…s to use milliseconds instead of seconds for more precise backoff timing
…limitFees, sleepBetweenRetries, sleepBetweenRetriesBackoff, and sleepMax to provide more insight into the application's behavior
…for better backoff strategy feat(.env): add SLEEPMAX variable with a value of 500ms for improved sleep duration in tests fix(liquidator_test.go): increase sleep duration in Test_monitorChannel from 1 second to 30 seconds for more reliable test execution
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sleep max can be removed, its not worth the code it adds for something trivial
@@ -507,7 +510,7 @@ func manageChannelLiquidity(info ManageChannelLiquidityInfo) error { | |||
|
|||
} | |||
|
|||
func performSwap(info ManageChannelLiquidityInfo, channel *lnrpc.Channel, swapAmount int64, rule nodeguard.LiquidityRule, span trace.Span, loopdCtx context.Context, retryCounter int, swapAmountTarget int64) error { | |||
func performSwap(info ManageChannelLiquidityInfo, channel *lnrpc.Channel, swapAmount int64, rule nodeguard.LiquidityRule, span trace.Span, loopdCtx context.Context, retryCounter int, swapAmountTarget int64, sleepBetweenRetries time.Duration) error { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if sleepBetweenRetries
is a global, why send it over as a function param?
@@ -64,53 +72,71 @@ All the flags can be set as environment variables, with the following format, ex | |||
- RETRIESBEFOREBACKOFF (optional) : Number of retries before applying backoff to the swap (default: 3) | |||
- BACKOFFCOEFFICIENT (optional) : Coefficient to apply to the backoff (default: 0.95) | |||
- BACKOFFLIMIT (optional) : Limit coefficient of the backoff (default: 0.1) | |||
- SLEEPBETWEENRETRIES (optional) : Base time to sleep between retries (default: 500ms) | |||
- SLEEPBETWEENRETRIESBACKOFF (optional) : Coefficient to apply to the backoff (default: 1.5) | |||
- SLEEPMAX (optional) : Maximum time to sleep between retries (default: 60s) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is not useful, I would reduce code and actually control this via config rather making code more complex.
I guess this PR has fall behind some others and have not much sense now |
Yes, I guess so |
Let's close it |
This one implemets: