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

Propagate Context Deadlines over RPCs by Adding Header #86

Merged
merged 7 commits into from
May 30, 2023

Conversation

aratz-lasa
Copy link
Collaborator

Description

This pull request aims to address issue #82, which relates to the loss of context deadlines when performing RPCs over the network using the HTTP client. The proposed solution is to propagate the context deadline as a header in the HTTP requests, ensuring that the deadlines are preserved throughout the network communication.

The following changes have been made to achieve this:

  • Created a new constant HttpHeaderTimeout in virtual/types/http.go to define the custom header name for context timeouts in HTTP requests.

  • Added a new function getContextFromRequest in the virtual/server.go file to extract the timeout value from the request header. This enables the propagation of context deadlines in HTTP headers.

  • Updated the InvokeActorRemote function in virtual/client.go to include the context deadline as a header in the HTTP requests.

@aratz-lasa aratz-lasa changed the title Feature/ctx over http Propagate Context Deadlines over RPCs by Adding Header May 29, 2023
examples/leaderregistry/main_test.go Show resolved Hide resolved
examples/leaderregistry/main_test.go Outdated Show resolved Hide resolved
ReplicationStrategy: types.ReplicaSelectionStrategyRandom,
}}

// Use require.Eventually to invoke the actor until it is replicated in all available servers.
Copy link
Owner

Choose a reason for hiding this comment

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

Its not really clear why this is important. I assume you want to guarantee it reached two different servers to ensure at least one of your requests went over the network right? Can you comment that? Also make sure that ForceRemoteProcedureCalls is enabled and call that out in the comment as well

virtual/server.go Show resolved Hide resolved
virtual/server.go Outdated Show resolved Hide resolved
virtual/types/http.go Outdated Show resolved Hide resolved
@aratz-lasa aratz-lasa merged commit 3b62d95 into master May 30, 2023
1 check 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.

None yet

2 participants