We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
In StreamingWebSocketClient.CloseDisposeAndClearRequestsAsync
StreamingWebSocketClient.CloseDisposeAndClearRequestsAsync
CancellationTokenSource tokenSource = null; try { if (_clientWebSocket != null && (_clientWebSocket.State == WebSocketState.Open || _clientWebSocket.State == WebSocketState.Connecting)) { tokenSource = new CancellationTokenSource(ConnectionTimeout); await _clientWebSocket.CloseOutputAsync(WebSocketCloseStatus.NormalClosure, "", tokenSource.Token).ConfigureAwait(false); while (_clientWebSocket.State != WebSocketState.Closed && !tokenSource.IsCancellationRequested) ; } } catch { } finally { tokenSource?.Dispose(); }
This while is CPU eater, use Task.Delay. The websocket never closed for some reason. (thats make that while go crazy on the CPU)
Task.Delay
while
Websocket closed and my CPU are safe
While loop eat the CPU because websocket state never be Closed (WebSocketState.Closed)
StreamingWebSocketClient.StartAsync()
StreamingWebSocketClient.Dispose()
StreamingWebSocketClient.StopAsync()
The text was updated successfully, but these errors were encountered:
Yes that will help, although why is your web socket not disconnecting straight away?
Sorry, something went wrong.
I have no idea, i use Infura
Infura
No branches or pull requests
In
StreamingWebSocketClient.CloseDisposeAndClearRequestsAsync
This while is CPU eater, use
Task.Delay
.The websocket never closed for some reason. (thats make that
while
go crazy on the CPU)Expected Behavior
Websocket closed and my CPU are safe
Current Behavior
While loop eat the CPU because websocket state never be Closed (WebSocketState.Closed)
Possible Solution
Task.Delay
for 1.0 or 0.5 sec even if the close problem fixed.Steps to Reproduce
StreamingWebSocketClient.StartAsync()
StreamingWebSocketClient.Dispose()
orStreamingWebSocketClient.StopAsync()
The text was updated successfully, but these errors were encountered: