From 0023e8df8071289a39bb2def2ee8c794f4bd4325 Mon Sep 17 00:00:00 2001 From: Vikhyath Mondreti Date: Sat, 12 Jul 2025 11:38:38 -0700 Subject: [PATCH] fix retry mechanism --- apps/sim/stores/operation-queue/store.ts | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/apps/sim/stores/operation-queue/store.ts b/apps/sim/stores/operation-queue/store.ts index 7aa9166985..f6a96c118f 100644 --- a/apps/sim/stores/operation-queue/store.ts +++ b/apps/sim/stores/operation-queue/store.ts @@ -156,6 +156,17 @@ export const useOperationQueueStore = create((set, get) => emitFunction(operation) retryTimeouts.delete(operationId) + + // Create new operation timeout for this retry attempt + const newTimeoutId = setTimeout(() => { + logger.warn('Retry operation timeout - no server response after 5 seconds', { + operationId, + }) + operationTimeouts.delete(operationId) + get().handleOperationTimeout(operationId) + }, 5000) + + operationTimeouts.set(operationId, newTimeoutId) }, delay) retryTimeouts.set(operationId, timeout) @@ -201,8 +212,6 @@ export const useOperationQueueStore = create((set, get) => }, handleSocketReconnection: () => { - logger.info('Socket reconnected - clearing timeouts but keeping operations for retry') - // Clear all timeouts since they're for the old socket retryTimeouts.forEach((timeout) => clearTimeout(timeout)) retryTimeouts.clear()