@nxtedition/cache 2.1.12 → 2.1.13
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/lib/index.js +5 -1
- package/package.json +3 -3
package/lib/index.js
CHANGED
|
@@ -850,7 +850,7 @@ export class Cache extends EventEmi
|
|
|
850
850
|
) {
|
|
851
851
|
// Wait for estimated completion: locked_at + our EMA-based timeout.
|
|
852
852
|
// Loop: wait for lock holder to write a value, retry if lock was stolen by another process.
|
|
853
|
-
for (let
|
|
853
|
+
for (let retryCount = 0; this.#dedupe.get(key) === selfPromise; retryCount++) {
|
|
854
854
|
// Add 5% jitter to reduce thundering herd on contention
|
|
855
855
|
const waitTime = Math.ceil(
|
|
856
856
|
Math.max(0, lockedAt + this.#lockTimeout - Date.now()) * (1 + Math.random() * 0.05),
|
|
@@ -889,6 +889,10 @@ export class Cache extends EventEmi
|
|
|
889
889
|
// We acquired the lock or lock is unavailable — do the work
|
|
890
890
|
break
|
|
891
891
|
}
|
|
892
|
+
|
|
893
|
+
if (retryCount > 1) {
|
|
894
|
+
break
|
|
895
|
+
}
|
|
892
896
|
}
|
|
893
897
|
|
|
894
898
|
{
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nxtedition/cache",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.13",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"types": "lib/index.d.ts",
|
|
@@ -30,9 +30,9 @@
|
|
|
30
30
|
"tsd": "^0.33.0",
|
|
31
31
|
"typescript": "^5.9.3"
|
|
32
32
|
},
|
|
33
|
-
"gitHead": "
|
|
33
|
+
"gitHead": "7d9b5f0e5066e988fa48e0703014509e217738e8",
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"@nxtedition/shared": "^5.1.
|
|
35
|
+
"@nxtedition/shared": "^5.1.11",
|
|
36
36
|
"xxhash-wasm": "^1.1.0"
|
|
37
37
|
}
|
|
38
38
|
}
|