From e18a6c9af720799c1025b174519d0ca9784ad5dc Mon Sep 17 00:00:00 2001 From: Corey Rice Date: Mon, 23 Oct 2023 08:05:48 -0300 Subject: [PATCH] fix(ci): increase retries on failing healthcheck --- docker-compose.yaml | 14 +++++++------- hardhat-healthcheck.js | 12 +++++++++--- 2 files changed, 16 insertions(+), 10 deletions(-) diff --git a/docker-compose.yaml b/docker-compose.yaml index a7bcee46..bffcfcad 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -15,11 +15,11 @@ services: condition: service_started postgres: condition: service_started - healthcheck: - test: ["CMD", "curl", "-f", "http://graph-node:8000"] - interval: 30s - timeout: 12s - retries: 10 + # healthcheck: + # test: ["CMD", "curl", "-f", "http://graph-node:8000"] + # interval: 30s + # timeout: 12s + # retries: 10 environment: postgres_host: postgres postgres_user: graph-node @@ -49,8 +49,8 @@ services: healthcheck: test: ["CMD", "node", "./hardhat-healthcheck.js"] interval: 30s - timeout: 12s - retries: 10 + timeout: 20s + retries: 20 ipfs: image: ipfs/go-ipfs:v0.4.23 ports: diff --git a/hardhat-healthcheck.js b/hardhat-healthcheck.js index 118cc3a3..b0f90250 100755 --- a/hardhat-healthcheck.js +++ b/hardhat-healthcheck.js @@ -4,9 +4,15 @@ * If node is up this function will silently succeed. If the node is down it will throw an error. */ async function healthCheck() { - const ethers = require('ethers'); - const localProvider = new ethers.providers.JsonRpcProvider(`http://hardhat:8545`) - localBlockNum = await localProvider.getBlockNumber(); + try { + const ethers = require('ethers'); + const localProvider = new ethers.providers.JsonRpcProvider(`http://hardhat:8545`) + localBlockNum = await localProvider.getBlockNumber(); + console.log(localBlockNum) + } catch (e) { + console.log(e) + throw e + } } module.export = healthCheck();