diff --git a/frontend/obsidian-plugin/src/debugging/flaky-websocket-factory.ts b/frontend/obsidian-plugin/src/debugging/flaky-websocket-factory.ts index f2f3db0a..56310aa6 100644 --- a/frontend/obsidian-plugin/src/debugging/flaky-websocket-factory.ts +++ b/frontend/obsidian-plugin/src/debugging/flaky-websocket-factory.ts @@ -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 { // maintain message order diff --git a/frontend/test-client/src/utils/flaky-websocket.ts b/frontend/test-client/src/utils/flaky-websocket-factory.ts similarity index 89% rename from frontend/test-client/src/utils/flaky-websocket.ts rename to frontend/test-client/src/utils/flaky-websocket-factory.ts index df1a98cd..6a146de2 100644 --- a/frontend/test-client/src/utils/flaky-websocket.ts +++ b/frontend/test-client/src/utils/flaky-websocket-factory.ts @@ -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 { // maintain message order