Skip to content

Commit

Permalink
fix(ci): increase retries on failing healthcheck
Browse files Browse the repository at this point in the history
  • Loading branch information
coreyar committed Oct 23, 2023
1 parent c830420 commit 1835f26
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 9 deletions.
12 changes: 6 additions & 6 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -50,7 +50,7 @@ services:
test: ["CMD", "node", "./hardhat-healthcheck.js"]
interval: 30s
timeout: 12s
retries: 10
retries: 15
ipfs:
image: ipfs/go-ipfs:v0.4.23
ports:
Expand Down
12 changes: 9 additions & 3 deletions hardhat-healthcheck.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();

0 comments on commit 1835f26

Please sign in to comment.