Skip to content

Commit

Permalink
Merge pull request #617 from oceanprotocol/bug/fix_undefined_object_s…
Browse files Browse the repository at this point in the history
…tatus

add condition
  • Loading branch information
alexcos20 authored Aug 15, 2024
2 parents cb1d516 + 13830c6 commit b18d45e
Showing 1 changed file with 10 additions and 11 deletions.
21 changes: 10 additions & 11 deletions src/components/core/utils/statusHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,15 +70,17 @@ async function getIndexerInfo(
config: OceanNodeConfig
): Promise<OceanNodeIndexer[]> {
const indexerNetworks: OceanNodeIndexer[] = []
for (const [key, indexedNetwork] of Object.entries(config.indexingNetworks)) {
if (config.hasIndexer) {
const blockNr = await getIndexerBlockInfo(oceanNode, indexedNetwork)
const indexer: OceanNodeIndexer = {
chainId: key,
network: indexedNetwork.network,
block: blockNr
if (config.indexingNetworks) {
for (const [key, indexedNetwork] of Object.entries(config.indexingNetworks)) {
if (config.hasIndexer) {
const blockNr = await getIndexerBlockInfo(oceanNode, indexedNetwork)
const indexer: OceanNodeIndexer = {
chainId: key,
network: indexedNetwork.network,
block: blockNr
}
indexerNetworks.push(indexer)
}
indexerNetworks.push(indexer)
}
}
return indexerNetworks
Expand Down Expand Up @@ -139,13 +141,11 @@ export async function status(
allowedAdmins: getAdminAddresses(config)
}
}

// need to update at least block info if available
if (config.supportedNetworks) {
nodeStatus.provider = getProviderInfo(config)
nodeStatus.indexer = await getIndexerInfo(oceanNode, config)
}

// only these 2 might change between requests
nodeStatus.platform.freemem = os.freemem()
nodeStatus.platform.loadavg = os.loadavg()
Expand All @@ -156,6 +156,5 @@ export async function status(
nodeStatus.c2dClusters = config.c2dClusters
nodeStatus.supportedSchemas = schemas.ddoSchemas
}

return nodeStatus
}

0 comments on commit b18d45e

Please sign in to comment.