Skip to content

Commit

Permalink
fix: move connectivity/login off consensus
Browse files Browse the repository at this point in the history
  • Loading branch information
alexfreska committed Aug 18, 2023
1 parent c120d7c commit 2659481
Show file tree
Hide file tree
Showing 7 changed files with 23 additions and 9 deletions.
7 changes: 7 additions & 0 deletions .changeset/slimy-stingrays-ring.md
Original file line number Diff line number Diff line change
@@ -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.
4 changes: 3 additions & 1 deletion apps/hostd/config/routes.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { stateHostKey } from '@siafoundation/react-hostd'

export const routes = {
home: '/',
volumes: {
Expand All @@ -20,4 +22,4 @@ export const routes = {
login: '/login',
}

export const connectivityRoute = '/state/consensus'
export const connectivityRoute = stateHostKey
4 changes: 3 additions & 1 deletion apps/renterd/config/routes.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { busStateKey } from '@siafoundation/react-renterd'

export const routes = {
home: '/',
files: {
Expand Down Expand Up @@ -29,4 +31,4 @@ export const routes = {
login: '/login',
}

export const connectivityRoute = '/bus/consensus/state'
export const connectivityRoute = busStateKey
4 changes: 3 additions & 1 deletion apps/walletd/config/routes.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { syncerPeersKey } from '@siafoundation/react-walletd'

export const routes = {
home: '/',
wallet: {
Expand All @@ -13,4 +15,4 @@ export const routes = {
login: '/login',
}

export const connectivityRoute = '/consensus/tip'
export const connectivityRoute = syncerPeersKey
4 changes: 3 additions & 1 deletion libs/react-hostd/src/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,12 @@ export type StateHost = {
buildTime: string
}

export const stateHostKey = '/state/host'

export function useStateHost(args?: HookArgsSwr<void, StateHost>) {
return useGetSwr({
...args,
route: '/state/host',
route: stateHostKey,
})
}

Expand Down
2 changes: 1 addition & 1 deletion libs/react-renterd/src/bus.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ export type StateResponse = BuildState & {
startTime: number
}

const busStateKey = '/bus/state'
export const busStateKey = '/bus/state'

export function useBusState(args?: HookArgsSwr<void, StateResponse>) {
return useGetSwr({
Expand Down
7 changes: 3 additions & 4 deletions libs/react-walletd/src/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ export function useConsensusNetwork(
})
}

// TODO
export function useEstimatedNetworkBlockHeight(): number {
const network = useConsensusNetwork({
config: {
Expand Down Expand Up @@ -90,12 +89,12 @@ type GatewayPeer = {
syncDuration: number
}

const syncerPeers = '/syncer/peers'
export const syncerPeersKey = '/syncer/peers'

export function useSyncerPeers(args?: HookArgsSwr<void, GatewayPeer[]>) {
return useGetSwr({
...args,
route: syncerPeers,
route: syncerPeersKey,
})
}

Expand All @@ -106,7 +105,7 @@ export function useSyncerConnect(args?: HookArgsCallback<void, string, never>) {
route: '/syncer/connect',
},
async (mutate) => {
mutate((key) => key === syncerPeers)
mutate((key) => key === syncerPeersKey)
}
)
}
Expand Down

0 comments on commit 2659481

Please sign in to comment.