Lint flaky websocket factory
This commit is contained in:
parent
0916f54045
commit
a9ddd1032f
2 changed files with 20 additions and 3 deletions
|
|
@ -1,4 +1,5 @@
|
||||||
import { helpers, Logger } from "sync-client";
|
import type { Logger } from "sync-client";
|
||||||
|
import { helpers } from "sync-client";
|
||||||
|
|
||||||
export function flakyWebSocketFactory(
|
export function flakyWebSocketFactory(
|
||||||
jitterScaleInSeconds: number,
|
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
|
data: string | ArrayBufferLike | Blob | ArrayBufferView
|
||||||
): Promise<void> {
|
): Promise<void> {
|
||||||
// maintain message order
|
// maintain message order
|
||||||
|
|
|
||||||
|
|
@ -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
|
data: string | ArrayBufferLike | Blob | ArrayBufferView
|
||||||
): Promise<void> {
|
): Promise<void> {
|
||||||
// maintain message order
|
// maintain message order
|
||||||
Loading…
Add table
Add a link
Reference in a new issue