Conversation
seunlanlege
approved these changes
Nov 18, 2019
dvdplm
approved these changes
Nov 18, 2019
| let metadata = self.jsonrpc_handler.extractor.read_metadata(&request); | ||
| let handler = match self.jsonrpc_handler.upgrade() { | ||
| Some(handler) => handler, | ||
| None => return RpcHandlerState::Writing(Response::closing()), |
Contributor
There was a problem hiding this comment.
Is returning a "500 Internal Error" here really the best? Could it be a "503 Service Unavailable" (with a Retry-After header even?), maybe Response::service_unavailable()?
Contributor
Author
There was a problem hiding this comment.
Yeah, makes sense. Will update.
dvdplm
reviewed
Nov 18, 2019
| .then(|_| Ok(())) | ||
| tokio::spawn( | ||
| http.serve_connection(socket, service) | ||
| .map_err(|e| error!("Error serving connection: {:?}", e)) |
Contributor
There was a problem hiding this comment.
rustfmt is angry with you about this line. Maybe put the map_err(|e| { on the preceding line?
Contributor
Author
|
That one is returning an |
Contributor
Author
|
Merging, as @dvdplm reported no performance degradation. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
...and rather spawn tasks directly on the executor.
This should fix issues with unresponsive server, while still not breaking the previous fix causing the server to not be closed properly when there were pending requests. Now we use
Weakreferences and only try to upgrade them when we handle the request.