MCPcopy Create free account
hub / github.com/coder/coder / sortProxiesByLatency

Function sortProxiesByLatency

site/src/modules/dashboard/Navbar/proxyUtils.tsx:3–12  ·  view source on GitHub ↗
(
	proxies: Proxies,
	latencies: ProxyLatencies,
)

Source from the content-addressed store, hash-verified

1import type { Proxies, ProxyLatencies } from "#/contexts/ProxyContext";
2
3export function sortProxiesByLatency(
4 proxies: Proxies,
5 latencies: ProxyLatencies,
6) {
7 return [...proxies].sort((a, b) => {
8 const latencyA = latencies?.[a.id]?.latencyMS ?? Number.POSITIVE_INFINITY;
9 const latencyB = latencies?.[b.id]?.latencyMS ?? Number.POSITIVE_INFINITY;
10 return latencyA - latencyB;
11 });
12}

Callers 2

ProxySettingsSubFunction · 0.90
ProxyMenuFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected