fix: update tauri-plugin-mihomo version, improve error handling #6149

This commit is contained in:
Tunglies
2026-01-24 09:19:52 +08:00
parent 6e16133393
commit 334cec3bde
4 changed files with 29 additions and 25 deletions

27
Cargo.lock generated
View File

@@ -3432,12 +3432,12 @@ dependencies = [
"libc",
"percent-encoding",
"pin-project-lite",
"socket2 0.6.1",
"socket2 0.5.10",
"system-configuration",
"tokio",
"tower-service",
"tracing",
"windows-registry 0.6.1",
"windows-registry",
]
[[package]]
@@ -4901,7 +4901,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7d8fae84b431384b68627d0f9b3b1245fcf9f46f6c0e3dc902e9dce64edd1967"
dependencies = [
"libc",
"windows-sys 0.61.2",
"windows-sys 0.48.0",
]
[[package]]
@@ -5710,7 +5710,7 @@ dependencies = [
"quinn-udp",
"rustc-hash",
"rustls",
"socket2 0.6.1",
"socket2 0.5.10",
"thiserror 2.0.18",
"tokio",
"tracing",
@@ -5748,7 +5748,7 @@ dependencies = [
"cfg_aliases",
"libc",
"once_cell",
"socket2 0.6.1",
"socket2 0.5.10",
"tracing",
"windows-sys 0.60.2",
]
@@ -7587,7 +7587,7 @@ dependencies = [
"thiserror 2.0.18",
"tracing",
"url",
"windows-registry 0.5.3",
"windows-registry",
"windows-result 0.3.4",
]
@@ -7700,7 +7700,7 @@ dependencies = [
[[package]]
name = "tauri-plugin-mihomo"
version = "0.1.3"
source = "git+https://github.com/clash-verge-rev/tauri-plugin-mihomo#65500f248533c0700a65f0f081e4bcadda4bff35"
source = "git+https://github.com/clash-verge-rev/tauri-plugin-mihomo#322d9f965b5daeb01bc9b16c73d199bb524c7a98"
dependencies = [
"base64 0.22.1",
"futures-util",
@@ -9327,7 +9327,7 @@ version = "0.1.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c2a7b1c03c876122aa43f3020e6c3c3ee5c05081c9a00739faf7503aeba10d22"
dependencies = [
"windows-sys 0.61.2",
"windows-sys 0.48.0",
]
[[package]]
@@ -9507,17 +9507,6 @@ dependencies = [
"windows-strings 0.4.2",
]
[[package]]
name = "windows-registry"
version = "0.6.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "02752bf7fbdcce7f2a27a742f798510f3e5ad88dbe84871e5168e2120c3d5720"
dependencies = [
"windows-link 0.2.1",
"windows-result 0.4.1",
"windows-strings 0.5.1",
]
[[package]]
name = "windows-result"
version = "0.3.4"

View File

@@ -19,7 +19,6 @@ use crate::{
use anyhow::Result;
use clash_verge_logging::{Type, logging};
use once_cell::sync::OnceCell;
use std::time::Duration;
use tauri::{AppHandle, Manager as _};
#[cfg(target_os = "macos")]
use tauri_plugin_autostart::MacosLauncher;
@@ -61,11 +60,11 @@ mod app_init {
.socket_path(crate::config::IClashTemp::guard_external_controller_ipc())
.pool_config(
tauri_plugin_mihomo::IpcPoolConfigBuilder::new()
.min_connections(1)
.min_connections(3)
.max_connections(32)
.idle_timeout(std::time::Duration::from_secs(60))
.health_check_interval(std::time::Duration::from_secs(60))
.reject_policy(RejectPolicy::Timeout(Duration::from_secs(3)))
.reject_policy(RejectPolicy::Wait)
.build(),
)
.build(),

View File

@@ -23,8 +23,8 @@ import {
} from "@mui/material";
import dayjs from "dayjs";
import relativeTime from "dayjs/plugin/relativeTime";
import { useCallback, useEffect, useMemo, useRef, useState } from "react";
import type { CSSProperties } from "react";
import { useCallback, useEffect, useMemo, useRef, useState } from "react";
import { useTranslation } from "react-i18next";
import { Outlet, useNavigate } from "react-router";
import { SWRConfig } from "swr";
@@ -257,12 +257,24 @@ const Layout = () => {
<SWRConfig
value={{
errorRetryCount: 3,
// TODO remove the 5000ms
errorRetryInterval: 5000,
onError: (error, key) => {
console.error(`[SWR Error] Key: ${key}, Error:`, error);
// FIXME the condition should not be handle gllobally
if (key !== "getAutotemProxy") {
console.error(`SWR Error for ${key}:`, error);
return;
}
// FIXME we need a better way to handle the retry when first booting app
const silentKeys = [
"getVersion",
"getClashConfig",
"getAutotemProxy",
];
if (silentKeys.includes(key)) return;
console.error(`[SWR Error] Key: ${key}, Error:`, error);
},
dedupingInterval: 2000,
}}

View File

@@ -32,7 +32,11 @@ export const AppDataProvider = ({
calcuProxies,
{
...SWR_REALTIME,
onError: (err) => console.warn("[DataProvider] Proxy fetch failed:", err),
onError: (_) => {
// FIXME when we intially start the app, and core is starting,
// there will be error thrown by getProxies API.
// We should handle this case properly later.
},
},
);