fix retry mechanism

This commit is contained in:
Vikhyath Mondreti
2025-07-12 11:38:38 -07:00
parent 2f726fa9f3
commit 0023e8df80

View File

@@ -156,6 +156,17 @@ export const useOperationQueueStore = create<OperationQueueState>((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<OperationQueueState>((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()