-
-
Notifications
You must be signed in to change notification settings - Fork 84
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Proxy for expensive API requests (#736)
* Proxy for expensive API requests When doing complicated refactors, the language server will often spam remote_control with a ton of operations when the refactor is going on. These operations will slow down both the editor and remote_control so that it's not particularly usable. In order to mitigate this, certain operations, like project compilation, can be buffered and completed when the refactor has completed. This PR implements a proxy module that buffers these complicated operations, and monitors the calling process. When that process exits, the buffered operations are emitted in remote_control, allowing them to complete without disrupting the refactor. In testing, I found two deadlocks. The first was that the build server was using RemoteControl.call to invoke itself rather than `GenServer.call`. This created an additional lock, and was unnecessary, because it's running locally. The second was more insidious. The proxy module made a bunch of separate calls to other modules, which in turn woud call `Build.with_lock`, which would then be run inside the proxy's process. This would cause fairly frequent locks in the proxy process. Moving these calls into tasks, fixes things, but creates the need for an additional `draining` state of the proxy, which it enteres if there are in-flight requests when `start_buffering` is called. --------- Co-authored-by: Zach Allaun <[email protected]>
- Loading branch information
1 parent
854fe9f
commit 1e3804f
Showing
23 changed files
with
1,134 additions
and
82 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
Oops, something went wrong.