@@ -871,7 +871,7 @@ export class HubConnection {
871
871
let previousReconnectAttempts = 0 ;
872
872
let retryError = error !== undefined ? error : new Error ( "Attempting to reconnect due to a unknown error." ) ;
873
873
874
- let nextRetryDelay = this . _getNextRetryDelay ( previousReconnectAttempts ++ , 0 , retryError ) ;
874
+ let nextRetryDelay = this . _getNextRetryDelay ( previousReconnectAttempts , 0 , retryError ) ;
875
875
876
876
if ( nextRetryDelay === null ) {
877
877
this . _logger . log ( LogLevel . Debug , "Connection not reconnecting because the IRetryPolicy returned null on the first reconnect attempt." ) ;
@@ -902,7 +902,7 @@ export class HubConnection {
902
902
}
903
903
904
904
while ( nextRetryDelay !== null ) {
905
- this . _logger . log ( LogLevel . Information , `Reconnect attempt number ${ previousReconnectAttempts } will start in ${ nextRetryDelay } ms.` ) ;
905
+ this . _logger . log ( LogLevel . Information , `Reconnect attempt number ${ previousReconnectAttempts + 1 } will start in ${ nextRetryDelay } ms.` ) ;
906
906
907
907
await new Promise ( ( resolve ) => {
908
908
this . _reconnectDelayHandle = setTimeout ( resolve , nextRetryDelay ! ) ;
@@ -941,8 +941,9 @@ export class HubConnection {
941
941
return ;
942
942
}
943
943
944
+ previousReconnectAttempts ++ ;
944
945
retryError = e instanceof Error ? e : new Error ( ( e as any ) . toString ( ) ) ;
945
- nextRetryDelay = this . _getNextRetryDelay ( previousReconnectAttempts ++ , Date . now ( ) - reconnectStartTime , retryError ) ;
946
+ nextRetryDelay = this . _getNextRetryDelay ( previousReconnectAttempts , Date . now ( ) - reconnectStartTime , retryError ) ;
946
947
}
947
948
}
948
949
0 commit comments