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
Conversation
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.
There was a problem hiding this 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. |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
|
||
import "context" | ||
|
||
// AsyncHandler wraps a Handler such that it each request is handled in its |
There was a problem hiding this comment.
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/
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.