Improve options handling and add --error-retry-base-interval
#245
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 explicitlyset.
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 anoption for
error-retry-base-interval
too we can avoid the need toforce 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.