Skip to content

Commit

Permalink
Merge pull request #1265 from edenia/fix/call-endpoint-with-timeout-1261
Browse files Browse the repository at this point in the history
fix(webapp): use UTC to check if endpoint is outdated
  • Loading branch information
xavier506 committed Aug 25, 2023
2 parents e48d21b + 7bd7688 commit 7ba87a3
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion webapp/src/utils/eosapi.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,11 @@ const callEosApi = async method => {
const headBlockTime = response.head_block_time

if (headBlockTime) {
const diffBlockTimems = new Date() - new Date(headBlockTime)
const nowUTC = new Date()

nowUTC.setMinutes(nowUTC.getMinutes() + nowUTC.getTimezoneOffset())

const diffBlockTimems = nowUTC - new Date(headBlockTime)

if (diffBlockTimems > eosConfig.syncToleranceInterval) {
throw new Error(`The endpoint ${eosApi.endpoint} is outdated`)
Expand Down

0 comments on commit 7ba87a3

Please sign in to comment.