fix: ensure id always exists while handling requests #70
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 elixir-lang/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!