From f68615277ea5c61e5d17d1e17fac2f0c50839b2d Mon Sep 17 00:00:00 2001 From: TaprootFreak <142087526+TaprootFreak@users.noreply.github.com> Date: Thu, 14 May 2026 19:03:41 +0200 Subject: [PATCH] Stop refetching tokens without a price source on every block MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When fetchPrice() returns null/undefined (e.g. CoinGecko returns {} for an unlisted collateral token), updatePrices() left the cache entry untouched and the 5-minute staleness check (timestamp + 300_000 < now) was still true on the next block tick. Combined with the 6-12s block polling that drives updatePrices(), this made the same handful of unlisted tokens generate ~50 upstream calls per hour per API instance — the dominant CoinGecko quota consumer after #110. Bump the entry's timestamp on a failed fetch too, so the retry honours the same 5-minute window as a successful fetch. --- prices/prices.service.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/prices/prices.service.ts b/prices/prices.service.ts index b53ea6f..9c829f5 100644 --- a/prices/prices.service.ts +++ b/prices/prices.service.ts @@ -259,6 +259,9 @@ export class PricesService { if (!price) { pricesQueryUpdateCountFailed += 1; + // bump timestamp on failure so we honour the 5-minute retry window + // instead of refetching on every block tick when a token has no price source + pricesQuery[addr] = { ...oldEntry, timestamp: Date.now() }; } else { pricesQuery[addr] = { ...erc,