fix: ensure id always exists while handling requests#70
Merged
Conversation
Collaborator
|
Thanks for the PR! It's okay if maybe it's too difficult, but do you think its possible to add a test for this case? |
Contributor
Author
|
Alright, I added a test specifically for the error case I was running into and verified that the test fails before this code change is applied. If you think other tests would be helpful let me know and I'm happy to keep going. |
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.
Fix for expert-lsp/expert#116
After processing a request, we attach it to
lsp.tasksby its ID. This ID is parsed within a separate Task and then sent back to the main process andreceived. There was at least one code path where we forgot to callsend(me, {:request_id, id})to send that ID back. This would cause the process to hang while we attempted toreceivea message that would never come.This PR assumes that every request will have an "id" key and pulls it off before starting the Task. That way we don't need to store it in the process dictionary, nor do we need to send/receive it between processes. I think that makes this code a little safer and more understandable. But if I'm missing something and you'd like this solved a different way please let me know!