• Increments retry count and last retry timestamp. Marks as permanently failed if max retries exceeded.

    Parameters

    • id: string

      The operation ID.

    Returns void

    export function incrementRetryCount(id: string): void {
    try {
    const queue = getFailedOperations();
    const operation = queue.operations.find((op) => op.id === id);

    if (operation) {
    operation.retryCount += 1;
    operation.lastRetryTimestamp = Date.now();

    // Mark as permanently failed if max retries exceeded
    if (operation.retryCount >= MAX_RETRY_ATTEMPTS) {
    operation.permanentlyFailed = true;
    console.debug(
    `[Storage] Operation ${id} marked as permanently failed after ${MAX_RETRY_ATTEMPTS} retries`,
    );
    }

    queue.lastUpdated = Date.now();

    storage.setItem(STORAGE_KEYS.FAILED_OPERATIONS, JSON.stringify(queue));
    console.debug(
    `[Storage] Incremented retry count for operation ${id}: ${operation.retryCount}`,
    );
    }
    } catch (error) {
    console.error("[Storage] Failed to increment retry count:", error);
    }
    }