diff --git a/services/blockchain-connector/config.js b/services/blockchain-connector/config.js index ad8864446f..cc725ebbbd 100644 --- a/services/blockchain-connector/config.js +++ b/services/blockchain-connector/config.js @@ -127,7 +127,7 @@ config.apiClient = { // Every n milliseconds, verify if client connection is alive config.clientConnVerifyInterval = - Number(process.env.CLIENT_CONNECTION_VERIFY_INTERVAL) || 30 * 1000; // in millisecs + Number(process.env.CLIENT_CONNECTION_VERIFY_INTERVAL) || 60 * 1000; // in millisecs // Backdoor config to restart the connector if the stall issue pops up - disabled by default const exitDelay = Number(process.env.CONNECTOR_EXIT_DELAY_IN_HOURS); // in hours diff --git a/services/blockchain-connector/shared/sdk/events.js b/services/blockchain-connector/shared/sdk/events.js index 1d92131d44..6b7982f9ff 100644 --- a/services/blockchain-connector/shared/sdk/events.js +++ b/services/blockchain-connector/shared/sdk/events.js @@ -139,27 +139,31 @@ const ensureAPIClientLiveness = () => { if (isNodeSynced && isGenesisBlockDownloaded) { setInterval(async () => { - if (typeof eventsCounter === 'number' && eventsCounter > 0) { - eventsCounter = 0; - } else { - if (typeof eventsCounter !== 'number') { - logger.warn( - `eventsCounter ended up with non-numeric value: ${JSON.stringify( - eventsCounter, - null, - '\t', - )}.`, - ); + try { + if (typeof eventsCounter === 'number' && eventsCounter > 0) { eventsCounter = 0; - } + } else { + if (typeof eventsCounter !== 'number') { + logger.warn( + `eventsCounter ended up with non-numeric value: ${JSON.stringify( + eventsCounter, + null, + '\t', + )}.`, + ); + eventsCounter = 0; + } - if (typeof eventSubscribeClientPoolIndex === 'number') { - const apiClient = await getApiClient(eventSubscribeClientPoolIndex); - Signals.get('resetApiClient').dispatch(apiClient, true); - logger.debug( - `Dispatched 'resetApiClient' signal for the event subscription API client ${apiClient.poolIndex}.`, - ); + if (typeof eventSubscribeClientPoolIndex === 'number') { + const apiClient = await getApiClient(eventSubscribeClientPoolIndex); + Signals.get('resetApiClient').dispatch(apiClient, true); + logger.debug( + `Dispatched 'resetApiClient' signal for the event subscription API client ${apiClient.poolIndex}.`, + ); + } } + } catch (_) { + // No action required } }, config.clientConnVerifyInterval); } else {