From db9ac3ba972d8e088b59c26d32d69cd6c9d97d01 Mon Sep 17 00:00:00 2001 From: karen-stepanyan <91897037+karen-stepanyan@users.noreply.github.com> Date: Fri, 9 Aug 2024 23:45:50 +0400 Subject: [PATCH] fix ICAP heartbeat cache TTL refresh (#3383) * fix ICAP heartbeat refresh * changeset --- .changeset/large-feet-serve.md | 5 +++++ packages/sources/tp/src/transport/price.ts | 15 ++++++--------- 2 files changed, 11 insertions(+), 9 deletions(-) create mode 100644 .changeset/large-feet-serve.md diff --git a/.changeset/large-feet-serve.md b/.changeset/large-feet-serve.md new file mode 100644 index 0000000000..a6bb64553e --- /dev/null +++ b/.changeset/large-feet-serve.md @@ -0,0 +1,5 @@ +--- +'@chainlink/tp-adapter': patch +--- + +Fix ICAP cache TTL refresh on heartbeat bug diff --git a/packages/sources/tp/src/transport/price.ts b/packages/sources/tp/src/transport/price.ts index e3baf5d4c9..64603711af 100644 --- a/packages/sources/tp/src/transport/price.ts +++ b/packages/sources/tp/src/transport/price.ts @@ -82,15 +82,12 @@ export const generateTransport = (generatePriceOptions: GeneratePriceOptions) => // Check for a heartbeat message, refresh the TTLs of all requested entries in the cache if (rec.includes('HBHHH')) { - const stream = rec.slice(22, 24) - if (stream === generatePriceOptions.streamName) { - logger.debug({ - msg: 'Received heartbeat message from WS, updating TTLs of active entries', - message, - }) - updateTTL(tpTransport, context.adapterSettings.CACHE_MAX_AGE) - return [] - } + logger.debug({ + msg: 'Received heartbeat message from WS, updating TTLs of active entries', + message, + }) + updateTTL(tpTransport, context.adapterSettings.CACHE_MAX_AGE) + return [] } const stream = rec.slice(31, 34)