Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Reduce overhead in
ManagedNamedPipeClient
during connection loop
The implementation of `NamedPipeClientStream` has some egregious use of `SpinOnce`: https://github.com/dotnet/runtime/blob/d59af2cf097acb100ad6a9cba652be34be6f4a2e/src/libraries/System.IO.Pipes/src/System/IO/Pipes/NamedPipeClientStream.cs#L151-L155 This adds perceivable overhead to the connect process, which we really don't want on a background thread. It is especially noticeable when discord is not running and the reconnect process is constantly running in the background. To get around this, we can request a connect timeout of 0 ms from the underlying API. Checking the implementations, this seems like a valid method, as long as there is external retry logic in place (which there is in the local class). Tested on Windows, macOS and linux.
- Loading branch information