Do not make empty queries to coingecko (#1285)

pull/1294/head
Asa Oines 2 years ago committed by GitHub
parent 4e76095876
commit bc32eb92ce
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 10
      typescript/sdk/src/gas/token-prices.ts

@ -104,10 +104,12 @@ export class CoinGeckoTokenPriceGetter implements TokenPriceGetter {
} }
const toQuery = chains.filter((c) => !this.cache.isFresh(c)); const toQuery = chains.filter((c) => !this.cache.isFresh(c));
try { if (toQuery.length > 0) {
await this.queryTokenPrices(toQuery); try {
} catch (e) { await this.queryTokenPrices(toQuery);
warn('Failed to query token prices', e); } catch (e) {
warn('Failed to query token prices', e);
}
} }
return chains.map((chain) => this.cache.fetch(chain)); return chains.map((chain) => this.cache.fetch(chain));
} }

Loading…
Cancel
Save