From 45c48cdf82b3a1b16dcfc267d7b3670b90cb126d Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 19 Jan 2026 12:52:55 +0000 Subject: [PATCH] Update api.js to use tryWithPrimaryServer and clean up unused imports Co-authored-by: Sunwuyuan <88357633+Sunwuyuan@users.noreply.github.com> --- src/utils/api.js | 6 +++--- src/utils/socketClient.js | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/utils/api.js b/src/utils/api.js index d4847a2..370e0b5 100644 --- a/src/utils/api.js +++ b/src/utils/api.js @@ -1,6 +1,6 @@ import axios from "@/axios/axios"; import {getSetting} from "@/utils/settings"; -import {tryWithRotation, isRotationEnabled} from "@/utils/serverRotation"; +import {tryWithPrimaryServer, isRotationEnabled} from "@/utils/serverRotation"; // Helper function to check if provider is valid for API calls const isValidProvider = () => { @@ -35,9 +35,9 @@ export const getNamespaceInfo = async () => { } try { - // Use rotation for classworkscloud provider + // Use primary server with fallback for classworkscloud provider if (isRotationEnabled()) { - const response = await tryWithRotation(async (serverUrl) => { + const response = await tryWithPrimaryServer(async (serverUrl) => { return await axios.get(`${serverUrl}/kv/_info`, { headers: getHeaders(), }); diff --git a/src/utils/socketClient.js b/src/utils/socketClient.js index 5f86814..f2391f4 100644 --- a/src/utils/socketClient.js +++ b/src/utils/socketClient.js @@ -4,7 +4,7 @@ import {io} from 'socket.io-client'; import {getSetting} from '@/utils/settings'; -import {getEffectiveServerUrl, isRotationEnabled, tryWithRotation} from '@/utils/serverRotation'; +import {getEffectiveServerUrl, isRotationEnabled} from '@/utils/serverRotation'; let socket = null; let connectedDomain = null;