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 6d5ba4c
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 11 deletions.
5 changes: 5 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,11 @@ jobs:
- name: Run Governance integration integration tests
run: |
docker exec -i subgraph-hardhat-node yarn workspace venus-governance-subgraph run test:integration --bail
- name: Debug
if: always()
run: |
docker inspect --format "{{json .State.Health }}" $(docker-compose ps -q mq)
- name: Stop containers
if: always()
Expand Down
16 changes: 8 additions & 8 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 All @@ -38,7 +38,7 @@ services:
- sh
- -c
- |
yarn &&PACKAGE=isolated-pools yarn workspace isolated-pools-subgraph run hardhat node --hostname 0.0.0.0
yarn && PACKAGE=isolated-pools yarn workspace isolated-pools-subgraph run hardhat node --hostname 0.0.0.0
# Installing again to link workspaces
ports:
- 8545:8545
Expand All @@ -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:
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 6d5ba4c

Please sign in to comment.