File tree Expand file tree Collapse file tree 1 file changed +6
-12
lines changed
Expand file tree Collapse file tree 1 file changed +6
-12
lines changed Original file line number Diff line number Diff line change @@ -1036,7 +1036,8 @@ export class LavalinkNode {
10361036 // Set reconnection state to pending
10371037 this . reconnectionState = ReconnectionState . PENDING ;
10381038 this . NodeManager . emit ( "reconnectinprogress" , this ) ;
1039- if ( instaReconnect ) {
1039+
1040+ const executeReconnect = ( ) => {
10401041 if ( this . reconnectAttempts >= this . options . retryAmount ) {
10411042 const error = new Error ( `Unable to connect after ${ this . options . retryAmount } attempts.` )
10421043
@@ -1049,21 +1050,14 @@ export class LavalinkNode {
10491050 this . reconnectionState = ReconnectionState . RECONNECTING ;
10501051 this . connect ( ) ;
10511052 this . reconnectAttempts ++ ;
1053+ } ;
1054+ if ( instaReconnect ) {
1055+ executeReconnect ( ) ;
10521056 return ;
10531057 }
10541058 this . reconnectTimeout = setTimeout ( ( ) => {
10551059 this . reconnectTimeout = null ;
1056- if ( this . reconnectAttempts >= this . options . retryAmount ) {
1057- const error = new Error ( `Unable to connect after ${ this . options . retryAmount } attempts.` )
1058- this . NodeManager . emit ( "error" , this , error ) ;
1059- this . reconnectionState = ReconnectionState . IDLE ;
1060- return this . destroy ( DestroyReasons . NodeReconnectFail ) ;
1061- }
1062-
1063- this . NodeManager . emit ( "reconnecting" , this ) ;
1064- this . reconnectionState = ReconnectionState . RECONNECTING ;
1065- this . connect ( ) ;
1066- this . reconnectAttempts ++ ;
1060+ executeReconnect ( ) ;
10671061 } , this . options . retryDelay || 1000 ) ;
10681062 }
10691063
You can’t perform that action at this time.
0 commit comments