Skip to content

Commit

Permalink
[Release] retry check checkHealthEvmRpc
Browse files Browse the repository at this point in the history
  • Loading branch information
thaovt287 committed Jun 4, 2024
1 parent c48ce8f commit 71875f9
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions scripts/exports/export-error-rpc.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ const isValidUrl = (url) => {
}
}

const checkHealthEvmRpc = async (url) => {
const _checkHealthEvmRpc = async (url) => {
try {
const web3 = new Web3(url)
await web3.eth.getBlockNumber()
Expand All @@ -49,6 +49,17 @@ const checkHealthEvmRpc = async (url) => {
}
}

const checkHealthEvmRpc = async (url, count = 0) => {

let status = await _checkHealthEvmRpc(url)
if(++count < 3 && status === STATUS.INACTIVE){
await new Promise(resolve => setTimeout(resolve, 1000));
status = await checkHealthEvmRpc(url, count)
}

return status
}

const checkHealthSubstrateRpc = async (url) => {
try {
let provider
Expand Down Expand Up @@ -164,7 +175,6 @@ setImmediate(async () => {
try {

await checkHealthRpc()

process.exit()

} catch (err) {
Expand Down

0 comments on commit 71875f9

Please sign in to comment.