Commit a574d98 1 parent 43e5845 commit a574d98 Copy full SHA for a574d98
File tree 3 files changed +10
-5
lines changed
3 files changed +10
-5
lines changed Original file line number Diff line number Diff line change 1
1
{
2
2
"name" : " wa-multi-session" ,
3
- "version" : " 2.0 .0" ,
3
+ "version" : " 2.1 .0" ,
4
4
"description" : " Multi Session Whatsapp Library" ,
5
5
"main" : " dist/index.js" ,
6
6
"types" : " dist/index.d.ts" ,
Original file line number Diff line number Diff line change @@ -64,19 +64,24 @@ export const startSession = async (
64
64
if ( connection === "close" ) {
65
65
const code = ( lastDisconnect ?. error as Boom ) ?. output ?. statusCode ;
66
66
let retryAttempt = retryCount . get ( sessionId ) ?? 0 ;
67
- const shouldRetry =
68
- code != DisconnectReason . loggedOut &&
69
- ( code == DisconnectReason . restartRequired || retryAttempt < 10 ) ;
70
- code != DisconnectReason . restartRequired && retryAttempt ++ ;
67
+ let shouldRetry ;
68
+ if ( code != DisconnectReason . loggedOut && retryAttempt < 10 ) {
69
+ shouldRetry = true ;
70
+ }
71
+ if ( shouldRetry ) {
72
+ retryAttempt ++ ;
73
+ }
71
74
if ( shouldRetry ) {
72
75
retryCount . set ( sessionId , retryAttempt ) ;
73
76
startSocket ( ) ;
74
77
} else {
78
+ retryCount . delete ( sessionId ) ;
75
79
deleteSession ( sessionId ) ;
76
80
callback . get ( CALLBACK_KEY . ON_DISCONNECTED ) ?.( sessionId ) ;
77
81
}
78
82
}
79
83
if ( connection == "open" ) {
84
+ retryCount . delete ( sessionId ) ;
80
85
callback . get ( CALLBACK_KEY . ON_CONNECTED ) ?.( sessionId ) ;
81
86
}
82
87
}
You can’t perform that action at this time.
0 commit comments