Lint flaky websocket factory

This commit is contained in:
Andras Schmelczer 2025-08-17 14:59:41 +01:00
parent 0916f54045
commit a9ddd1032f
No known key found for this signature in database
GPG key ID: FC8F2C3D3D1A718C
2 changed files with 20 additions and 3 deletions

View file

@ -1,4 +1,5 @@
import { helpers, Logger } from "sync-client";
import type { Logger } from "sync-client";
import { helpers } from "sync-client";
export function flakyWebSocketFactory(
jitterScaleInSeconds: number,
@ -53,7 +54,15 @@ export function flakyWebSocketFactory(
};
}
public async send(
public send(
data: string | ArrayBufferLike | Blob | ArrayBufferView
): void {
this.waitingSend(data).catch((error: unknown) => {
logger.error(`Error sending WebSocket message: ${error}`);
});
}
private async waitingSend(
data: string | ArrayBufferLike | Blob | ArrayBufferView
): Promise<void> {
// maintain message order

View file

@ -55,7 +55,15 @@ export function flakyWebSocketFactory(
};
}
public async send(
public send(
data: string | ArrayBufferLike | Blob | ArrayBufferView
): void {
this.waitingSend(data).catch((error: unknown) => {
logger.error(`Error sending WebSocket message: ${error}`);
});
}
private async waitingSend(
data: string | ArrayBufferLike | Blob | ArrayBufferView
): Promise<void> {
// maintain message order