Skip to content

chore: add function to refetch latencies to ProxyContext #7769

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Jun 1, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
fmt
  • Loading branch information
Emyrk committed Jun 1, 2023
commit 5296e1a8d6398c9ea0b7bee6481c80f3712237d9
2 changes: 1 addition & 1 deletion site/jest.setup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ jest.mock("contexts/useProxyLatency", () => ({
}, {} as Record<string, ProxyLatencyReport>)
}, [proxies])

return {proxyLatencies, refetch: jest.fn() }
return { proxyLatencies, refetch: jest.fn() }
},
}))

Expand Down
5 changes: 3 additions & 2 deletions site/src/contexts/useProxyLatency.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,13 @@ export const useProxyLatency = (
)

// This latestFetchRequest is used to trigger a refetch of the proxy latencies.
const [latestFetchRequest, setLatestFetchRequest] = useState(new Date().toISOString())
const [latestFetchRequest, setLatestFetchRequest] = useState(
new Date().toISOString(),
)
const refetch = () => {
setLatestFetchRequest(new Date().toISOString())
}


// Only run latency updates when the proxies change.
useEffect(() => {
if (!proxies) {
Expand Down