Skip to content

armgit / macro

Public Imported from GitHub
0

Macro is a unified workspace for teams: email, chat, docs, tasks, agents, calls, and CRM — @-linked together with shared AI memory.

chore(ws): add max retries for cognition, connection, storage (#444)

teo32ff5917d1fe
diff --git a/js/app/packages/service-cognition/websocket.ts b/js/app/packages/service-cognition/websocket.ts
index 520316dbe9..a8fab99dd9 100644
--- a/js/app/packages/service-cognition/websocket.ts
+++ b/js/app/packages/service-cognition/websocket.ts
@@ -55,7 +55,8 @@ export const ws: CognitionWebsocket = new WebsocketBuilder(resolveWsUrl)
.withSerializer(
new JsonSerializer<ToWebSocketMessage, FromWebSocketMessage>()
)
- .withBackoff(new ConstantBackoff(500))
+ .withBackoff(new ConstantBackoff(2_000))
+ .withMaxRetries(20)
.withHeartbeat({
interval: 1_000,
timeout: 1_000,
diff --git a/js/app/packages/service-connection/websocket.ts b/js/app/packages/service-connection/websocket.ts
index 7efa1970a5..9838941a9e 100644
--- a/js/app/packages/service-connection/websocket.ts
+++ b/js/app/packages/service-connection/websocket.ts
@@ -42,6 +42,7 @@ export const ws = new WebsocketBuilder(resolveWsUrl)
new JsonSerializer<ToWebsocketMessage, FromWebsocketMessage>()
)
.withBackoff(new LinearBackoff(500, 500))
+ .withMaxRetries(20)
.withHeartbeat({
interval: 1_000,
timeout: 1_000,
diff --git a/js/app/packages/service-storage/websocket.ts b/js/app/packages/service-storage/websocket.ts
index c43a15e571..458f0ab433 100644
--- a/js/app/packages/service-storage/websocket.ts
+++ b/js/app/packages/service-storage/websocket.ts
@@ -21,7 +21,8 @@ const HEARTBEAT_INTERVAL = 300000;
const HEARTBEAT_TIMEOUT = 5000;
export const ws = new WebsocketBuilder(SERVER_HOSTS['websocket-service'])
- .withBackoff(new ConstantBackoff(1500))
+ .withBackoff(new ConstantBackoff(2_000))
+ .withMaxRetries(20)
.withHeartbeat({
pingMessage: JSON.stringify({ action: 'wsping' }),
pongMessage: 'pong',