diff --git a/src/components/proxy/use-filter-sort.ts b/src/components/proxy/use-filter-sort.ts index 74999f9b..accec284 100644 --- a/src/components/proxy/use-filter-sort.ts +++ b/src/components/proxy/use-filter-sort.ts @@ -109,12 +109,14 @@ function sortProxies( const list = proxies.slice(); if (sortType === 1) { - list.sort((a, b) => { - const ad = delayManager.getDelayFix(a, groupName); - const bd = delayManager.getDelayFix(b, groupName); + const toSortableValue = (delay: number) => { + if (!Number.isFinite(delay) || delay <= 0) return Number.MAX_SAFE_INTEGER; + return delay; + }; - if (ad === -1 || ad === -2) return 1; - if (bd === -1 || bd === -2) return -1; + list.sort((a, b) => { + const ad = toSortableValue(delayManager.getDelayFix(a, groupName)); + const bd = toSortableValue(delayManager.getDelayFix(b, groupName)); return ad - bd; }); diff --git a/src/services/delay.ts b/src/services/delay.ts index cb9db2fb..d855eda2 100644 --- a/src/services/delay.ts +++ b/src/services/delay.ts @@ -197,7 +197,7 @@ class DelayManager { formatDelay(delay: number, timeout = 10000) { if (delay === -1) return "-"; if (delay === -2) return "testing"; - if (delay === 0 || (delay >= timeout && delay <= 1e5)) return "timeout"; + if (delay === 0 || (delay >= timeout && delay <= 1e5)) return "Timeout"; if (delay > 1e5) return "Error"; return `${delay}`; }