Propagate Context Deadlines over RPCs by Adding Header #86
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.
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
invirtual/types/http.go
to define the custom header name for context timeouts in HTTP requests.Added a new function
getContextFromRequest
in thevirtual/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 invirtual/client.go
to include the context deadline as a header in the HTTP requests.