Skip to content

Commit

Permalink
Fix race condition in DefaultSocketApi causing disconnection loop whe…
Browse files Browse the repository at this point in the history
…n changing credentials
  • Loading branch information
nielsvanvelzen committed Nov 19, 2024
1 parent d7656db commit 89d3146
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ public class DefaultSocketApi(
.state
.onEach { connectionState ->
// Automatically reconnect when the socket is closed while subscriptions are active
if (_subscriptionCount > 0 && _currentCredentials != null && connectionState is SocketConnectionState.Disconnected) {
if (_subscriptionCount > 0 && _currentCredentials != null && connectionState is SocketConnectionState.Disconnected && !reconnectMutex.isLocked) {
socketReconnectPolicy.notifyDisconnected()

val reconnectDelay = socketReconnectPolicy.getReconnectDelay()
Expand Down

0 comments on commit 89d3146

Please sign in to comment.