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

Make networking handshake timeout configurable #1796

Merged
merged 5 commits into from
Aug 8, 2024

Conversation

muhamadazmy
Copy link
Contributor

Fixes #1765

Copy link
Contributor

@pcholakov pcholakov left a comment

Choose a reason for hiding this comment

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

Nice! LGTM but you probably want to see 👍 from Till or Ahmed ;-)

///
/// Time a node waits for handshake message to be received before
/// giving up
pub handshake_timeout: Duration,
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we use humantime::Duration instead and setup schemar's correctly for it? You can find an example in config/http.rs

Copy link
Contributor Author

Choose a reason for hiding this comment

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

definitely!

Copy link
Contributor

@AhmedSoliman AhmedSoliman left a comment

Choose a reason for hiding this comment

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

Looks pretty good, the comment about passing in NetworkingOptions is optional, but the main blocker is the need to use humantime::Duration in configuration types.

}

impl ConnectionManager {
/// Creates the connection manager.
pub(super) fn new(metadata: Metadata) -> Self {
pub(super) fn new(metadata: Metadata, handshake_timeout: Duration) -> Self {
Copy link
Contributor

Choose a reason for hiding this comment

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

It might be better to future-proof this as pass in NetworkingOptions since this is a long-living object anyway.

Copy link
Contributor Author

@muhamadazmy muhamadazmy Aug 7, 2024

Choose a reason for hiding this comment

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

Yeah, i was thinking of that i just didn't want to make clones of it everywhere. And was honestly considering using an Arc for it (maybe with a type alias to reduce clutter).

On the other hand, the value cloned is not big and hence this can be an unnecessary optimisation

what do you think ?

Copy link
Contributor

Choose a reason for hiding this comment

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

ConnectionManager is a long living value that lives as long as the node, cloning is absolutely fine here.

Take the entire NetworkingOptions for future-proofing
Comment on lines 70 to 71
let retry_policy = self.options.connect_retry_policy.clone();
let mut retry_policy = retry_policy.iter();
Copy link
Contributor

Choose a reason for hiding this comment

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

Why do you need to clone here? I think if you capture max_attempts() here you wouldn't have a problem with the projection reference below.

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 definitely, my fault. for some reason in my head iter() consumed self but it actually doesn't.

crates/types/src/config/networking.rs Outdated Show resolved Hide resolved
crates/types/src/config/networking.rs Outdated Show resolved Hide resolved
drop the close of the rety policy
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 handshake timeout configurable @muhamadazmy. The changes look good to me.

@muhamadazmy muhamadazmy merged commit ab1235f into restatedev:main Aug 8, 2024
9 checks passed
@muhamadazmy muhamadazmy deleted the issue-1765 branch August 8, 2024 07:51
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 handshake timeout for network connections configurable
4 participants