Skip to content

Commit

Permalink
fix ICAP heartbeat cache TTL refresh (#3383)
Browse files Browse the repository at this point in the history
* fix ICAP heartbeat refresh

* changeset
  • Loading branch information
karen-stepanyan authored Aug 9, 2024
1 parent f8133f8 commit db9ac3b
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 9 deletions.
5 changes: 5 additions & 0 deletions .changeset/large-feet-serve.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@chainlink/tp-adapter': patch
---

Fix ICAP cache TTL refresh on heartbeat bug
15 changes: 6 additions & 9 deletions packages/sources/tp/src/transport/price.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit db9ac3b

Please sign in to comment.