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

Improve options handling and add --error-retry-base-interval #245

Merged
merged 5 commits into from
Sep 9, 2023

Conversation

RyuzakiKK
Copy link
Contributor

  • Remove deprecated "http-timeout" and "http-error-retry" options

    Those two options have been deprecated 5 years ago.
    There is likely no reason to keep them around anymore.

  • Keep the CLI options while querying the stores in info

  • Correctly set the default option values and merge them with the config

    When loading a config file, we need to set the options to their default
    values. Otherwise, when merging it with the CLI options, we could end up
    with unexpected results.

    Additionally we need to distinguish between a CLI option that is set to
    its default value because it was not provided as a launch parameter or
    if it was explicitly set by the client. This is important because in
    MergedWith() we should prefer the CLI option only if it was explicitly
    set.

  • Add --error-retry-base-interval as a CLI option

    Setting the base interval between error retries is a useful option,
    especially when the Internet connection might be unstable.

    Given that error-retry can already be set via the CLI, by adding an
    option for error-retry-base-interval too we can avoid the need to
    force users to ship a config file when its only purpose was to only
    change this value.

  • Set a 500ms default value for error-retry-base-interval

    When the Internet connection is unstable, a few requests might fail. In
    those cases, by default, Desync retries 3 times before giving up.

    However, if the connection momentarily becomes unstable and you retry
    immediately without waiting, the chances of those attempts still failing
    are very high.

    With this commit we set a more reasonable 500ms of base wait interval to
    give the clients an higher chance of success.

Those two options have been deprecated 5 years ago.
There is likely no reason to keep them around anymore.

Signed-off-by: Ludovico de Nittis <[email protected]>
When loading a config file, we need to set the options to their default
values. Otherwise, when merging it with the CLI options, we could end up
with unexpected results.

Additionally we need to distinguish between a CLI option that is set to
its default value because it was not provided as a launch parameter or
if it was explicitly set by the client. This is important because in
`MergedWith()` we should prefer the CLI option only if it was explicitly
set.

Signed-off-by: Ludovico de Nittis <[email protected]>
Setting the base interval between error retries is a useful option,
especially when the Internet connection might be unstable.

Given that `error-retry` can already be set via the CLI, by adding an
option for `error-retry-base-interval` too we can avoid the need to
force users to ship a config file when its only purpose was to only
change this value.

Signed-off-by: Ludovico de Nittis <[email protected]>
When the Internet connection is unstable, a few requests might fail. In
those cases, by default, Desync retries 3 times before giving up.

However, if the connection momentarily becomes unstable and you retry
immediately without waiting, the chances of those attempts still failing
are very high.

With this commit we set a more reasonable 500ms of base wait interval to
give the clients an higher chance of success.

Signed-off-by: Ludovico de Nittis <[email protected]>
@RyuzakiKK
Copy link
Contributor Author

Remove deprecated "http-timeout" and "http-error-retry" options

This makes the parsing of the properties easier. AFAICT those has been marked as deprecated 5 years ago, so I just deleted them.
If you prefer to still keep them around, I can revisit this PR.

Keep the CLI options while querying the stores in info

It's not entirely clear to me why the stores in info were queried with a default command option instead of using the user provided one. Please let me know in case I overlook something.

Set a 500ms default value for error-retry-base-interval

If you prefer something different than 500ms, just let me know. The important thing for us is to have the --error-retry-base-interval so that we can set a reasonable wait interval without having to ship a config file just to set that value.

@folbricht
Copy link
Owner

Looks good. Thank you

@folbricht folbricht merged commit a60262d into folbricht:master Sep 9, 2023
3 checks passed
@RyuzakiKK RyuzakiKK deleted the ErrorRetry branch September 25, 2023 08:17
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.

2 participants