utilitas 2001.1.102 → 2001.1.103
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/utilitas.lite.mjs +1 -1
- package/dist/utilitas.lite.mjs.map +1 -1
- package/lib/manifest.mjs +1 -1
- package/lib/utilitas.mjs +6 -4
- package/package.json +1 -1
package/lib/manifest.mjs
CHANGED
package/lib/utilitas.mjs
CHANGED
|
@@ -850,12 +850,14 @@ const getLockKey = key => {
|
|
|
850
850
|
};
|
|
851
851
|
|
|
852
852
|
const lock = async (key, options) => {
|
|
853
|
-
|
|
854
|
-
while (new Date().getTime()
|
|
855
|
-
< (options?.timeout || 1000)) {
|
|
853
|
+
const stdKey = getLockKey(key);
|
|
854
|
+
while (new Date().getTime() < parseInt(LOCKS?.[stdKey] || 0)) {
|
|
856
855
|
await timeout(options?.checkInterval || 1000);
|
|
857
856
|
}
|
|
858
|
-
return
|
|
857
|
+
return {
|
|
858
|
+
time: LOCKS[stdKey] = new Date().getTime() + (options?.timeout || 1000),
|
|
859
|
+
unlock: () => unlock(key),
|
|
860
|
+
};
|
|
859
861
|
};
|
|
860
862
|
|
|
861
863
|
export {
|