Skip to content

Commit 7bac03c

Browse files
committed
🐛 fix ttl to fetching cache state
1 parent 32a8b64 commit 7bac03c

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/cache/storage-cache.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import { anonymizeKey } from "../util/anonymize-key";
88

99
const LOG_PREFIX = `[CACHE]`;
1010
const CACHE_STATE_PREFIX = "cache-state:";
11-
const CACHE_STATE_TTL = 30 * 60 * 1000; // 30 minutes
11+
const CACHE_STATE_SECONDS_TTL = 1800; // 30 minutes
1212

1313
export class StorageCache implements ContactCache {
1414
private storage: StorageAdapter;
@@ -153,7 +153,7 @@ export class StorageCache implements ContactCache {
153153
{
154154
state: CacheItemStateType.FETCHING,
155155
},
156-
CACHE_STATE_TTL
156+
CACHE_STATE_SECONDS_TTL
157157
);
158158

159159
try {
@@ -171,7 +171,7 @@ export class StorageCache implements ContactCache {
171171
//in any case we need to reset the cacheItemState to prevent loop of fetching state
172172
await this.storage.set<CacheItemState>(this.getCacheItemKey(key), {
173173
state: CacheItemStateType.CACHED,
174-
updated: new Date().getTime(),
174+
updated: Date.now(),
175175
});
176176
}
177177
}

0 commit comments

Comments
 (0)