@@ -62,20 +62,17 @@ interface SocketListeningEventMap {
62
62
interface SocketEmitEventMap {
63
63
[ SocketEvents . DEPLOY ] : ( options : DeployCommandOptions ) => void ;
64
64
[ SocketEvents . UNDEPLOY ] : ( ) => void ;
65
- [ SocketEvents . PING ] : ( ) => void ;
66
65
}
67
66
68
67
@scoped ( Lifecycle . ContainerScoped )
69
68
@injectable ( )
70
69
export class DefaultRepeaterServer implements RepeaterServer {
71
70
private readonly MAX_DEPLOYMENT_TIMEOUT = 60_000 ;
72
- private readonly MAX_PING_INTERVAL = 10_000 ;
73
71
private readonly MAX_RECONNECTION_ATTEMPTS = 20 ;
74
72
private readonly MIN_RECONNECTION_DELAY = 1000 ;
75
73
private readonly MAX_RECONNECTION_DELAY = 86_400_000 ;
76
74
77
75
private latestReconnectionError ?: Error ;
78
- private pingTimer ?: Timer ;
79
76
private connectionTimer ?: Timer ;
80
77
private _socket ?: Socket < SocketListeningEventMap , SocketEmitEventMap > ;
81
78
private connectionAttempts = 0 ;
@@ -104,7 +101,6 @@ export class DefaultRepeaterServer implements RepeaterServer {
104
101
105
102
public disconnect ( ) {
106
103
this . events . removeAllListeners ( ) ;
107
- this . clearPingTimer ( ) ;
108
104
this . clearConnectionTimer ( ) ;
109
105
110
106
this . _socket ?. disconnect ( ) ;
@@ -128,8 +124,6 @@ export class DefaultRepeaterServer implements RepeaterServer {
128
124
)
129
125
] ) ;
130
126
131
- this . createPingTimer ( ) ;
132
-
133
127
return result ;
134
128
}
135
129
@@ -336,8 +330,6 @@ export class DefaultRepeaterServer implements RepeaterServer {
336
330
} ;
337
331
338
332
private handleDisconnect = ( reason : string ) : void => {
339
- this . clearPingTimer ( ) ;
340
-
341
333
if ( reason !== 'io client disconnect' ) {
342
334
this . events . emit ( RepeaterServerEvents . DISCONNECTED ) ;
343
335
}
@@ -356,19 +348,4 @@ export class DefaultRepeaterServer implements RepeaterServer {
356
348
) ;
357
349
this . logger . error ( 'An error occurred' , error ) ;
358
350
}
359
-
360
- private createPingTimer ( ) {
361
- this . clearPingTimer ( ) ;
362
-
363
- this . pingTimer = setInterval (
364
- ( ) => this . socket . volatile . emit ( SocketEvents . PING ) ,
365
- this . MAX_PING_INTERVAL
366
- ) . unref ( ) ;
367
- }
368
-
369
- private clearPingTimer ( ) {
370
- if ( this . pingTimer ) {
371
- clearInterval ( this . pingTimer ) ;
372
- }
373
- }
374
351
}
0 commit comments