[price-service] Hotfix cache (#508)

This commit is contained in:
Ali Behjati 2023-01-18 19:20:48 +01:00 committed by GitHub
parent 0812994745
commit 59b0efbf6c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 10 additions and 5 deletions

View File

@ -1,12 +1,12 @@
{
"name": "@pythnetwork/pyth-price-service",
"version": "2.3.2",
"version": "2.3.3",
"lockfileVersion": 2,
"requires": true,
"packages": {
"": {
"name": "@pythnetwork/pyth-price-service",
"version": "2.3.2",
"version": "2.3.3",
"license": "Apache-2.0",
"dependencies": {
"@certusone/wormhole-sdk": "^0.9.9",

View File

@ -1,6 +1,6 @@
{
"name": "@pythnetwork/pyth-price-service",
"version": "2.3.2",
"version": "2.3.3",
"description": "Pyth Price Service",
"main": "index.js",
"scripts": {

View File

@ -114,8 +114,13 @@ export class VaaCache {
async removeExpiredValues() {
const now = Math.floor(Date.now() / 1000);
for (const arr of this.cache.values()) {
arr.filter((vaaConf) => now - vaaConf.publishTime < this.ttl);
for (const key of this.cache.keys()) {
this.cache.set(
key,
this.cache
.get(key)!
.filter((vaaConf) => now - vaaConf.publishTime < this.ttl)
);
}
}
}