@gravito/stasis 3.2.0 → 3.2.4
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/dist/index.js +11 -4
- package/dist/index.js.map +4 -4
- package/package.json +3 -4
- package/dist/index.cjs +0 -1886
- package/dist/index.cjs.map +0 -27
package/dist/index.js
CHANGED
|
@@ -346,10 +346,17 @@ class CacheRepository {
|
|
|
346
346
|
let value;
|
|
347
347
|
for (let attempt = 0;attempt <= maxRetries; attempt++) {
|
|
348
348
|
try {
|
|
349
|
+
let timeoutId;
|
|
349
350
|
value = await Promise.race([
|
|
350
351
|
Promise.resolve(callback()),
|
|
351
|
-
new Promise((_, reject) =>
|
|
352
|
+
new Promise((_, reject) => {
|
|
353
|
+
timeoutId = setTimeout(() => reject(new Error("Refresh timeout")), timeoutMillis);
|
|
354
|
+
timeoutId.unref?.();
|
|
355
|
+
})
|
|
352
356
|
]);
|
|
357
|
+
if (timeoutId) {
|
|
358
|
+
clearTimeout(timeoutId);
|
|
359
|
+
}
|
|
353
360
|
break;
|
|
354
361
|
} catch (err) {
|
|
355
362
|
lastError = err;
|
|
@@ -752,6 +759,7 @@ class CircuitBreakerStore {
|
|
|
752
759
|
}
|
|
753
760
|
|
|
754
761
|
// src/stores/FileStore.ts
|
|
762
|
+
import { createHash } from "node:crypto";
|
|
755
763
|
import { dirname, join } from "node:path";
|
|
756
764
|
import {
|
|
757
765
|
getRuntimeAdapter,
|
|
@@ -763,7 +771,6 @@ import {
|
|
|
763
771
|
runtimeStatFull,
|
|
764
772
|
runtimeWriteFileExclusive
|
|
765
773
|
} from "@gravito/core";
|
|
766
|
-
import { NativeHasher } from "@gravito/core/ffi";
|
|
767
774
|
class FileStore {
|
|
768
775
|
options;
|
|
769
776
|
cleanupTimer = null;
|
|
@@ -1002,7 +1009,7 @@ class FileStore {
|
|
|
1002
1009
|
}
|
|
1003
1010
|
}
|
|
1004
1011
|
function hashKey(key) {
|
|
1005
|
-
return
|
|
1012
|
+
return createHash("sha256").update(key).digest("hex");
|
|
1006
1013
|
}
|
|
1007
1014
|
function syncHashKey(key) {
|
|
1008
1015
|
let hash = 5381;
|
|
@@ -1863,4 +1870,4 @@ export {
|
|
|
1863
1870
|
CacheManager
|
|
1864
1871
|
};
|
|
1865
1872
|
|
|
1866
|
-
//# debugId=
|
|
1873
|
+
//# debugId=8B96F3A91C013F7964756E2164756E21
|