@pioneer-platform/pioneer-cache 3.0.0 → 3.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.turbo/turbo-build.log +1 -1
- package/CHANGELOG.md +15 -0
- package/dist/core/base-cache.js +9 -0
- package/package.json +3 -3
- package/src/core/base-cache.ts +9 -0
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
2
|
|
|
3
|
-
> @pioneer-platform/pioneer-cache@3.0.
|
|
3
|
+
> @pioneer-platform/pioneer-cache@3.0.2 build /Users/highlander/WebstormProjects/keepkey-stack/projects/pioneer/modules/pioneer/pioneer-cache
|
|
4
4
|
> tsc
|
|
5
5
|
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,20 @@
|
|
|
1
1
|
# @pioneer-platform/pioneer-cache
|
|
2
2
|
|
|
3
|
+
## 3.0.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- chore: chore: version bump pioneer-sdk and pioneer-server for perf fixes
|
|
8
|
+
- Updated dependencies
|
|
9
|
+
- @pioneer-platform/pioneer-discovery@10.0.4
|
|
10
|
+
|
|
11
|
+
## 3.0.1
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- Updated dependencies
|
|
16
|
+
- @pioneer-platform/pioneer-discovery@10.0.3
|
|
17
|
+
|
|
3
18
|
## 3.0.0
|
|
4
19
|
|
|
5
20
|
### Major Changes
|
package/dist/core/base-cache.js
CHANGED
|
@@ -435,6 +435,15 @@ class BaseCache {
|
|
|
435
435
|
const cachedValue = await this.getCached(key);
|
|
436
436
|
if (cachedValue) {
|
|
437
437
|
log.warn(tag, `Fetch failed after ${fetchTime}ms, returning stale cache: ${key}`);
|
|
438
|
+
// FIX: Update fetchedAt to now so freshness check reflects "last attempted"
|
|
439
|
+
// rather than "last successfully fetched from network". The data is still the
|
|
440
|
+
// best available — the node is just temporarily unreachable.
|
|
441
|
+
const staleValue = cachedValue.value;
|
|
442
|
+
if (staleValue && typeof staleValue === 'object') {
|
|
443
|
+
const now = Date.now();
|
|
444
|
+
staleValue.fetchedAt = now;
|
|
445
|
+
staleValue.fetchedAtISO = new Date(now).toISOString();
|
|
446
|
+
}
|
|
438
447
|
return cachedValue.value;
|
|
439
448
|
}
|
|
440
449
|
// Try legacy cache as last resort
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pioneer-platform/pioneer-cache",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.2",
|
|
4
4
|
"description": "Unified caching system for Pioneer platform with Redis backend",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
@@ -15,10 +15,10 @@
|
|
|
15
15
|
"license": "MIT",
|
|
16
16
|
"dependencies": {
|
|
17
17
|
"@pioneer-platform/loggerdog": "8.11.0",
|
|
18
|
+
"@pioneer-platform/redis-queue": "8.12.21",
|
|
18
19
|
"@pioneer-platform/default-redis": "8.11.11",
|
|
19
|
-
"@pioneer-platform/pioneer-discovery": "10.0.0",
|
|
20
20
|
"@pioneer-platform/pioneer-caip": "9.27.10",
|
|
21
|
-
"@pioneer-platform/
|
|
21
|
+
"@pioneer-platform/pioneer-discovery": "10.0.4"
|
|
22
22
|
},
|
|
23
23
|
"devDependencies": {
|
|
24
24
|
"@types/jest": "^29.5.0",
|
package/src/core/base-cache.ts
CHANGED
|
@@ -513,6 +513,15 @@ export abstract class BaseCache<T> {
|
|
|
513
513
|
const cachedValue = await this.getCached(key);
|
|
514
514
|
if (cachedValue) {
|
|
515
515
|
log.warn(tag, `Fetch failed after ${fetchTime}ms, returning stale cache: ${key}`);
|
|
516
|
+
// FIX: Update fetchedAt to now so freshness check reflects "last attempted"
|
|
517
|
+
// rather than "last successfully fetched from network". The data is still the
|
|
518
|
+
// best available — the node is just temporarily unreachable.
|
|
519
|
+
const staleValue = cachedValue.value as any;
|
|
520
|
+
if (staleValue && typeof staleValue === 'object') {
|
|
521
|
+
const now = Date.now();
|
|
522
|
+
staleValue.fetchedAt = now;
|
|
523
|
+
staleValue.fetchedAtISO = new Date(now).toISOString();
|
|
524
|
+
}
|
|
516
525
|
return cachedValue.value;
|
|
517
526
|
}
|
|
518
527
|
|