Skip to content
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

Closed
wants to merge 7 commits into from
Closed

Conversation

markettes
Copy link
Contributor

This one implemets:

  • Incremental sleep times between retries
  • Max sleep time

…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
gcaracuel
gcaracuel previously approved these changes Mar 27, 2024
Copy link
Contributor

@gcaracuel gcaracuel left a 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
@markettes markettes requested a review from gcaracuel April 2, 2024 11:30
Copy link
Contributor

@Jossec101 Jossec101 left a 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 {
Copy link
Contributor

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)
Copy link
Contributor

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.

@gcaracuel
Copy link
Contributor

I guess this PR has fall behind some others and have not much sense now

@markettes
Copy link
Contributor Author

markettes commented Jun 20, 2024

I guess this PR has fall behind some others and have not much sense now

Yes, I guess so

@Jossec101
Copy link
Contributor

Let's close it

@Jossec101 Jossec101 closed this Jun 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants