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

Configurable network error retry policy #1782

Merged
merged 3 commits into from
Aug 5, 2024

Conversation

muhamadazmy
Copy link
Contributor

@muhamadazmy muhamadazmy commented Aug 2, 2024

Fixes #1769

This makes the network error retry policy configurable for the node

Copy link
Contributor

@tillrohrmann tillrohrmann left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for making the network error retry policy configurable @muhamadazmy :-) The changes look good to me. I had one suggestion for a slight simplification. +1 for merging after resolving the comment.

/// # Network error retry policy
///
/// The retry policy for node network error
network_error_retry_policy: Option<RetryPolicy>,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wondering whether we can define the type as RetryPolicy because RetryPolicy has a None variant as well.

Copy link
Contributor Author

@muhamadazmy muhamadazmy Aug 5, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@tillrohrmann
True, there is a None variant on the RetryPolicy. But i didn't want break compatibility with current configurations files which has no network_error_retry_policy defined. If we just use RetryPolicy it will default to None (hence no retry), which breaks the default behaviour which has exponential retry.

But with Option, if network_error_retry_policy is completely missing from the config the function network_error_retry_policy can still return a default policy (the one that was hard coded in code), unless you configure retry policy explicitly to None in config (like network_error_retry_policy: none ) to explicitly disable retries

I am still totally fine of using RetryPolicy instead of Option if you think that is acceptable behaviour, just let me know :)

Copy link
Contributor

@tillrohrmann tillrohrmann Aug 5, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we configure serde using the same default value as the one we define in the Default implementation? Then if nothing is specified we would default to

RetryPolicy::exponential(
      Duration::from_millis(10),
      2.0,
      Some(15),
      Some(Duration::from_secs(5))

Copy link
Contributor

@tillrohrmann tillrohrmann Aug 5, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that the current Default implementation should already be respected. No need to instruct serde separately. The defaults for the configuration are configured here:

let mut figment = Figment::from(Serialized::defaults(defaults))
.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah that's good to know. Good one :)

Copy link
Contributor

@tillrohrmann tillrohrmann left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work @muhamadazmy. LGTM. +1 for merging :-)

@muhamadazmy muhamadazmy merged commit 70563f4 into restatedev:main Aug 5, 2024
4 checks passed
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.

Make upsert timeout configurable
2 participants