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

Handle is blocking #12

Merged
merged 2 commits into from Feb 21, 2017
Merged

Handle is blocking #12

merged 2 commits into from Feb 21, 2017

Conversation

keegancsmith
Copy link
Member

We have strict ordering requirements of how we handle FileSystem requests in
LSP. As such relying on the ordering the goroutine scheduler runs requests in
leads to potential out of order mutations to the FS. As such we update the
jsonrpc2 implementation to by default block until Handle returns (note it can
still respond to the request at a later stage). For more simple use cases we
provide the AsyncHandler which will work like the previous implementation.

We have strict ordering requirements of how we handle FileSystem requests in
LSP. As such relying on the ordering the goroutine scheduler runs requests in
leads to potential out of order mutations to the FS. As such we update the
jsonrpc2 implementation to by default block until Handle returns (note it can
still respond to the request at a later stage). For more simple use cases we
provide the AsyncHandler which will work like the previous implementation.
Copy link
Member

@sqs sqs left a comment

Choose a reason for hiding this comment

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

LGTM

// Handle is called to handle a request. No other requests are handled
// until it returns. If you do not require strict ordering behaviour
// of received RPCs, it is suggested to wrap your handler in
// AsyncHandler.

Choose a reason for hiding this comment

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

Can this be modified so that other requests are still handled and only the response is deferred?

Copy link
Member Author

Choose a reason for hiding this comment

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

No other requests are handled until it returns.

That means until the function returns, not until there is a response. See the signature for the handler, it does not return a response.

@keegancsmith keegancsmith merged commit 3a7c446 into master Feb 21, 2017
@keegancsmith keegancsmith deleted the k/sync branch February 21, 2017 12:25

import "context"

// AsyncHandler wraps a Handler such that it each request is handled in its

Choose a reason for hiding this comment

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

s/that it each/that each/

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

4 participants