Skip to content

Commit

Permalink
Freshness test: look at latest block time, not latst update
Browse files Browse the repository at this point in the history
  • Loading branch information
csillag committed Jun 28, 2023
1 parent 895acc0 commit ce8d161
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/app/components/OfflineBanner/hook.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export const useRuntimeFreshness = (scope: SearchScope): FreshnessInfo => {
throw new AppError(AppErrors.UnsupportedLayer)
}
const query = useGetRuntimeStatus(scope.network, scope.layer)
const timeDistance = useFormattedTimestampString(query?.data?.data.latest_update)
const timeDistance = useFormattedTimestampString(query?.data?.data.latest_block_time)
if (query.isLoading) {
return {
outOfDate: undefined,
Expand All @@ -51,7 +51,7 @@ export const useRuntimeFreshness = (scope: SearchScope): FreshnessInfo => {
outOfDate: true,
}
}
const timeSinceLastUpdate = query.dataUpdatedAt - new Date(data.latest_update).getTime()
const timeSinceLastUpdate = query.dataUpdatedAt - new Date(data.latest_block_time).getTime()
const { outOfDateThreshold } = paraTimesConfig[scope.layer]
return {
outOfDate: timeSinceLastUpdate > outOfDateThreshold,
Expand Down

0 comments on commit ce8d161

Please sign in to comment.