diff --git a/lib/block-listeners/cosmos-node-subscription.js b/lib/block-listeners/cosmos-node-subscription.js index 83676b228a..25609ace79 100644 --- a/lib/block-listeners/cosmos-node-subscription.js +++ b/lib/block-listeners/cosmos-node-subscription.js @@ -32,11 +32,11 @@ class CosmosNodeSubscription { async pollForNewBlock() { this.pollingTimeout = setTimeout(async () => { const block = await this.cosmosAPI.getBlockByHeight() - if (this.height !== block.height) { // apparently the cosmos db takes a while to serve the content after a block has been updated // if we don't do this, we run into errors as the data is not yet available setTimeout(() => this.newBlockHandler(block), COSMOS_DB_DELAY) + this.height = block.height // this needs to be set somewhere // we are safe, that the chain produced a block so it didn't hang up if (this.chainHangup) clearTimeout(this.chainHangup) @@ -47,6 +47,8 @@ class CosmosNodeSubscription { // if there are no new blocks for some time, trigger an error // TODO: show this error automatically in the UI + // clearing previous timeout, otherwise it will execute + if (this.chainHangup) clearTimeout(this.chainHangup) this.chainHangup = setTimeout(() => { console.error(`Chain ${this.network.id} seems to have halted.`) Sentry.captureException( diff --git a/lib/source/cosmosV0-source.js b/lib/source/cosmosV0-source.js index 5e7bd66a01..2a27297151 100644 --- a/lib/source/cosmosV0-source.js +++ b/lib/source/cosmosV0-source.js @@ -22,8 +22,10 @@ class CosmosV0API extends RESTDataSource { } async getRetry(url, intent = 0) { + // cleareing memoizedResults + this.memoizedResults.clear() try { - return await this.get(url) + return await this.get(url, null, { cacheOptions: { ttl: 1 } }) // normally setting cacheOptions should be enought, but... } catch (error) { // give up if (intent >= 3) {