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

Add side effect retry #21

Merged
merged 1 commit into from
Sep 6, 2024

Conversation

igalshilman
Copy link
Contributor

No description provided.

src/lib.rs Outdated Show resolved Hide resolved
src/lib.rs Outdated Show resolved Hide resolved
src/lib.rs Outdated
.sys_run_exit(NonEmptyValue::Failure(value.into()))
.sys_run_exit(
RunExitResult::TerminalFailure(value.into()),
RetryPolicy::Infinite,
Copy link
Collaborator

Choose a reason for hiding this comment

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

if you change this to exponential, you enable the retry policy feature.

src/lib.rs Outdated Show resolved Hide resolved
Comment on lines +125 to +126
factor: 2.0,
max_interval: None,
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why not exposing these two as well?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

we'll expose when we'd need them

Copy link
Collaborator

Choose a reason for hiding this comment

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

we'll need them for the e2e if you want the test to complete quickly :) https://github.com/restatedev/sdk-rust/blob/main/test-services/src/failing.rs#L122

Also I think in particular max_interval is important, otherwise the retry delay with exponent 2 quickly evolves into some too long delay!

.map_err(Into::into)
}

fn sys_run_exit_failure(
Copy link
Collaborator

Choose a reason for hiding this comment

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

Perhaps to avoid any confusion is better to rename this to sys_run_exit_failure_terminal

Comment on lines 87 to 91
Attributes:
initial_interval: The initial interval in milliseconds to wait before the first retry.
max_attempts: The maximum number of attempts to retry.
max_duration: The maximum duration in milliseconds to retry.
"""
Copy link
Collaborator

Choose a reason for hiding this comment

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

@igalshilman igalshilman marked this pull request as ready for review September 6, 2024 10:14
Comment on lines +337 to +339
except:
# The VM decided to retry, therefore we tear down the current execution
return None
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why not rethrowing (as you were doing before essentially)?

@igalshilman igalshilman merged commit 32ec905 into restatedev:main Sep 6, 2024
3 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.

2 participants