Skip to content

Commit

Permalink
Update Socket to fix spamming issue
Browse files Browse the repository at this point in the history
  • Loading branch information
dassjosh authored Jul 13, 2022
1 parent eb33f6a commit 661b3c1
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions Oxide.Ext.Discord/WebSockets/Socket.cs
Original file line number Diff line number Diff line change
Expand Up @@ -263,8 +263,10 @@ public void Reconnect()
SocketState = SocketState.PendingReconnect;
}

_reconnectRetries++;

//If we haven't had any errors reconnect to the gateway
if (_reconnectRetries == 0)
if (_reconnectRetries == 1)
{
Interface.Oxide.NextTick(Connect);
return;
Expand All @@ -283,7 +285,6 @@ public void Reconnect()

_logger.Warning($"Attempting to reconnect to Discord... [Retry={_reconnectRetries.ToString()}]");
_reconnectTimer.Start();
_reconnectRetries++;
}

private void ReconnectWebsocket(object sender, ElapsedEventArgs e)
Expand All @@ -305,4 +306,4 @@ internal void ResetRetries()
_reconnectRetries = 0;
}
}
}
}

0 comments on commit 661b3c1

Please sign in to comment.