diff --git a/.changeset/slimy-stingrays-ring.md b/.changeset/slimy-stingrays-ring.md new file mode 100644 index 000000000..c08373205 --- /dev/null +++ b/.changeset/slimy-stingrays-ring.md @@ -0,0 +1,7 @@ +--- +'hostd': minor +'renterd': minor +'walletd': minor +--- + +The connectivity and login check no longer depends on consensus APIs which in some rare cases can be unresponsive. diff --git a/apps/hostd/config/routes.ts b/apps/hostd/config/routes.ts index 95b8cd9bc..a9e36f402 100644 --- a/apps/hostd/config/routes.ts +++ b/apps/hostd/config/routes.ts @@ -1,3 +1,5 @@ +import { stateHostKey } from '@siafoundation/react-hostd' + export const routes = { home: '/', volumes: { @@ -20,4 +22,4 @@ export const routes = { login: '/login', } -export const connectivityRoute = '/state/consensus' +export const connectivityRoute = stateHostKey diff --git a/apps/renterd/config/routes.ts b/apps/renterd/config/routes.ts index ed6208a46..258dd52aa 100644 --- a/apps/renterd/config/routes.ts +++ b/apps/renterd/config/routes.ts @@ -1,3 +1,5 @@ +import { busStateKey } from '@siafoundation/react-renterd' + export const routes = { home: '/', files: { @@ -29,4 +31,4 @@ export const routes = { login: '/login', } -export const connectivityRoute = '/bus/consensus/state' +export const connectivityRoute = busStateKey diff --git a/apps/walletd/config/routes.ts b/apps/walletd/config/routes.ts index de501391e..9cbbbbd06 100644 --- a/apps/walletd/config/routes.ts +++ b/apps/walletd/config/routes.ts @@ -1,3 +1,5 @@ +import { syncerPeersKey } from '@siafoundation/react-walletd' + export const routes = { home: '/', wallet: { @@ -13,4 +15,4 @@ export const routes = { login: '/login', } -export const connectivityRoute = '/consensus/tip' +export const connectivityRoute = syncerPeersKey diff --git a/libs/react-hostd/src/api.ts b/libs/react-hostd/src/api.ts index b4dc5aa01..e78610edf 100644 --- a/libs/react-hostd/src/api.ts +++ b/libs/react-hostd/src/api.ts @@ -32,10 +32,12 @@ export type StateHost = { buildTime: string } +export const stateHostKey = '/state/host' + export function useStateHost(args?: HookArgsSwr) { return useGetSwr({ ...args, - route: '/state/host', + route: stateHostKey, }) } diff --git a/libs/react-renterd/src/bus.ts b/libs/react-renterd/src/bus.ts index fdaad3799..50246d4e7 100644 --- a/libs/react-renterd/src/bus.ts +++ b/libs/react-renterd/src/bus.ts @@ -52,7 +52,7 @@ export type StateResponse = BuildState & { startTime: number } -const busStateKey = '/bus/state' +export const busStateKey = '/bus/state' export function useBusState(args?: HookArgsSwr) { return useGetSwr({ diff --git a/libs/react-walletd/src/api.ts b/libs/react-walletd/src/api.ts index bf65b8da2..ff80237ce 100644 --- a/libs/react-walletd/src/api.ts +++ b/libs/react-walletd/src/api.ts @@ -52,7 +52,6 @@ export function useConsensusNetwork( }) } -// TODO export function useEstimatedNetworkBlockHeight(): number { const network = useConsensusNetwork({ config: { @@ -90,12 +89,12 @@ type GatewayPeer = { syncDuration: number } -const syncerPeers = '/syncer/peers' +export const syncerPeersKey = '/syncer/peers' export function useSyncerPeers(args?: HookArgsSwr) { return useGetSwr({ ...args, - route: syncerPeers, + route: syncerPeersKey, }) } @@ -106,7 +105,7 @@ export function useSyncerConnect(args?: HookArgsCallback) { route: '/syncer/connect', }, async (mutate) => { - mutate((key) => key === syncerPeers) + mutate((key) => key === syncerPeersKey) } ) }