diff --git a/src/components/core/utils/statusHandler.ts b/src/components/core/utils/statusHandler.ts index 8a39acf34..d591791c8 100644 --- a/src/components/core/utils/statusHandler.ts +++ b/src/components/core/utils/statusHandler.ts @@ -70,15 +70,17 @@ async function getIndexerInfo( config: OceanNodeConfig ): Promise { 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 @@ -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() @@ -156,6 +156,5 @@ export async function status( nodeStatus.c2dClusters = config.c2dClusters nodeStatus.supportedSchemas = schemas.ddoSchemas } - return nodeStatus }