Skip to content

Commit

Permalink
Limit returned value to 100
Browse files Browse the repository at this point in the history
  • Loading branch information
toaspzoo committed Jul 20, 2021
1 parent 06e3abc commit 1ab74ba
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion packages/api-cardano-db-hasura/src/HasuraClient.ts
Expand Up @@ -482,12 +482,14 @@ export class HasuraClient {
)
const { tip } = result?.cardano[0]
const lastEpoch = result?.epochs[0]
const syncPercentage = tip.slotNo / nodeTipSlotNumber * 100;
return {
// cardano-db-sync writes the epoch record at the end of each epoch during times of bulk sync
// The initialization state can be determined by comparing the last epoch record against the
// tip
initialized: lastEpoch.number === tip.epoch?.number,
syncPercentage: Math.round(tip.slotNo / nodeTipSlotNumber * 100).toFixed(2)
//we cannot assume that actual db-sync progress will be less or equal to node sync progress due to race condition at the query time
syncPercentage: syncPercentage > 100 ? 100 : syncPercentage,
}
}

Expand Down

0 comments on commit 1ab74ba

Please sign in to comment.