Skip to content

Commit 011b95f

Browse files
authored
feat: IPFS Retry Info for /health (#751)
1 parent 02b4ada commit 011b95f

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

src/API/HealthController.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ interface HealthObject {
1010
readonly blockchainInfo: object
1111
readonly networkInfo: object
1212
readonly estimatedSmartFeeInfo: object
13+
readonly ipfsRetryInfo: object
1314
}
1415

1516
@injectable()
@@ -76,20 +77,35 @@ export class HealthController {
7677
}
7778
}
7879

80+
private async getIPFSRetryInfo(): Promise<object> {
81+
try {
82+
const {
83+
hardFailures = 0,
84+
softFailures = 0,
85+
} = await this.collection.findOne({ name: 'ipfsDownloadRetries' }) || {}
86+
const ipfsRetryInfo = { hardFailures, softFailures }
87+
return ipfsRetryInfo
88+
} catch (e) {
89+
return { error: 'Error retrieving ipfsRetryInfo...' }
90+
}
91+
}
92+
7993
async getHealth(): Promise<HealthObject> {
8094
const mongoIsConnected = await this.checkMongo()
8195
const ipfsInfo = await this.getIPFSInfo()
8296
const walletInfo = await this.getWalletInfo()
8397
const blockchainInfo = await this.getBlockchainInfo()
8498
const networkInfo = await this.getNetworkInfo()
8599
const estimatedSmartFeeInfo = await this.getEstimatedSmartFeeInfo()
100+
const ipfsRetryInfo = await this.getIPFSRetryInfo()
86101
return {
87102
mongoIsConnected,
88103
ipfsInfo,
89104
walletInfo,
90105
blockchainInfo,
91106
networkInfo,
92107
estimatedSmartFeeInfo,
108+
ipfsRetryInfo,
93109
}
94110
}
95111
}

0 commit comments

Comments
 (0)