Skip to content

Commit 07490a1

Browse files
refactor(repeater): stop sending ping event
1 parent e06a01f commit 07490a1

File tree

1 file changed

+0
-23
lines changed

1 file changed

+0
-23
lines changed

packages/repeater/src/lib/DefaultRepeaterServer.ts

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -62,20 +62,17 @@ interface SocketListeningEventMap {
6262
interface SocketEmitEventMap {
6363
[SocketEvents.DEPLOY]: (options: DeployCommandOptions) => void;
6464
[SocketEvents.UNDEPLOY]: () => void;
65-
[SocketEvents.PING]: () => void;
6665
}
6766

6867
@scoped(Lifecycle.ContainerScoped)
6968
@injectable()
7069
export class DefaultRepeaterServer implements RepeaterServer {
7170
private readonly MAX_DEPLOYMENT_TIMEOUT = 60_000;
72-
private readonly MAX_PING_INTERVAL = 10_000;
7371
private readonly MAX_RECONNECTION_ATTEMPTS = 20;
7472
private readonly MIN_RECONNECTION_DELAY = 1000;
7573
private readonly MAX_RECONNECTION_DELAY = 86_400_000;
7674

7775
private latestReconnectionError?: Error;
78-
private pingTimer?: Timer;
7976
private connectionTimer?: Timer;
8077
private _socket?: Socket<SocketListeningEventMap, SocketEmitEventMap>;
8178
private connectionAttempts = 0;
@@ -104,7 +101,6 @@ export class DefaultRepeaterServer implements RepeaterServer {
104101

105102
public disconnect() {
106103
this.events.removeAllListeners();
107-
this.clearPingTimer();
108104
this.clearConnectionTimer();
109105

110106
this._socket?.disconnect();
@@ -128,8 +124,6 @@ export class DefaultRepeaterServer implements RepeaterServer {
128124
)
129125
]);
130126

131-
this.createPingTimer();
132-
133127
return result;
134128
}
135129

@@ -336,8 +330,6 @@ export class DefaultRepeaterServer implements RepeaterServer {
336330
};
337331

338332
private handleDisconnect = (reason: string): void => {
339-
this.clearPingTimer();
340-
341333
if (reason !== 'io client disconnect') {
342334
this.events.emit(RepeaterServerEvents.DISCONNECTED);
343335
}
@@ -356,19 +348,4 @@ export class DefaultRepeaterServer implements RepeaterServer {
356348
);
357349
this.logger.error('An error occurred', error);
358350
}
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-
}
374351
}

0 commit comments

Comments
 (0)