Skip to content

Commit 59b0efb

Browse files
authored
[price-service] Hotfix cache (#508)
1 parent 0812994 commit 59b0efb

File tree

3 files changed

+10
-5
lines changed

3 files changed

+10
-5
lines changed

price-service/package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

price-service/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@pythnetwork/pyth-price-service",
3-
"version": "2.3.2",
3+
"version": "2.3.3",
44
"description": "Pyth Price Service",
55
"main": "index.js",
66
"scripts": {

price-service/src/listen.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,8 +114,13 @@ export class VaaCache {
114114

115115
async removeExpiredValues() {
116116
const now = Math.floor(Date.now() / 1000);
117-
for (const arr of this.cache.values()) {
118-
arr.filter((vaaConf) => now - vaaConf.publishTime < this.ttl);
117+
for (const key of this.cache.keys()) {
118+
this.cache.set(
119+
key,
120+
this.cache
121+
.get(key)!
122+
.filter((vaaConf) => now - vaaConf.publishTime < this.ttl)
123+
);
119124
}
120125
}
121126
}

0 commit comments

Comments
 (0)