From 5350d3491b821761ce7fc07923eba408c4970612 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E1=B4=80=E1=B4=8D=E1=B4=9B=E1=B4=8F=E1=B4=80=E1=B4=87?= =?UTF-8?q?=CA=80?= Date: Sun, 15 Feb 2026 16:31:31 +0800 Subject: [PATCH] =?UTF-8?q?chore:=20=E5=8D=87=E7=BA=A7=20rust=20=E5=88=B0?= =?UTF-8?q?=201.93.1=EF=BC=8C=E7=A7=BB=E9=99=A4=20ws=20=E4=B8=AD=E7=9A=84?= =?UTF-8?q?=E4=B8=80=E4=BA=9B=E6=97=A0=E7=94=A8=E5=8F=98=E9=87=8F=20(#650)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- rust-toolchain.toml | 2 +- web/src/lib/ws.ts | 9 --------- 2 files changed, 1 insertion(+), 10 deletions(-) diff --git a/rust-toolchain.toml b/rust-toolchain.toml index 0c1a074..19f76d4 100644 --- a/rust-toolchain.toml +++ b/rust-toolchain.toml @@ -1,3 +1,3 @@ [toolchain] -channel = "1.93.0" +channel = "1.93.1" components = ["clippy"] diff --git a/web/src/lib/ws.ts b/web/src/lib/ws.ts index 6adf284..cd9c1ac 100644 --- a/web/src/lib/ws.ts +++ b/web/src/lib/ws.ts @@ -26,13 +26,11 @@ interface ClientEvent { type LogsCallback = (data: string) => void; type TasksCallback = (data: TaskStatus) => void; type SysInfoCallback = (data: SysInfo) => void; -type ErrorCallback = (error: Event) => void; export class WebSocketManager { private static instance: WebSocketManager; private socket: WebSocket | null = null; private connected = false; - private connecting = false; private reconnectTimer: ReturnType | null = null; private reconnectAttempts = 0; private maxReconnectAttempts = 5; @@ -41,7 +39,6 @@ export class WebSocketManager { private logsSubscribers: Set = new Set(); private tasksSubscribers: Set = new Set(); private sysInfoSubscribers: Set = new Set(); - private errorSubscribers: Set = new Set(); private subscribedEvents: Set = new Set(); private connectionPromise: Promise | null = null; @@ -61,7 +58,6 @@ export class WebSocketManager { if (this.connectionPromise) return this.connectionPromise; this.connectionPromise = new Promise((resolve, reject) => { - this.connecting = true; const token = api.getAuthToken() || ''; try { @@ -73,7 +69,6 @@ export class WebSocketManager { ); this.socket.onopen = () => { this.connected = true; - this.connecting = false; this.reconnectAttempts = 0; this.connectionPromise = null; this.resubscribeEvents(); @@ -84,20 +79,17 @@ export class WebSocketManager { this.socket.onclose = () => { this.connected = false; - this.connecting = false; this.connectionPromise = null; this.scheduleReconnect(); }; this.socket.onerror = (error) => { console.error('WebSocket error:', error); - this.connecting = false; this.connectionPromise = null; reject(error); toast.error('WebSocket 连接发生错误,请检查网络或稍后重试'); }; } catch (error) { - this.connecting = false; this.connectionPromise = null; reject(error); console.error('Failed to create WebSocket:', error); @@ -273,7 +265,6 @@ export class WebSocketManager { } this.connected = false; - this.connecting = false; this.connectionPromise = null; this.subscribedEvents.clear(); }