braidfs 0.0.87 → 0.0.88
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/index.js +15 -18
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -530,7 +530,7 @@ async function sync_url(url) {
|
|
|
530
530
|
}
|
|
531
531
|
|
|
532
532
|
if (!start_something()) return
|
|
533
|
-
await
|
|
533
|
+
await within_fiber(fullpath, async () => {
|
|
534
534
|
var fullpath = await get_fullpath()
|
|
535
535
|
if (await require('fs').promises.access(meta_path).then(
|
|
536
536
|
() => 1, () => 0)) {
|
|
@@ -584,7 +584,7 @@ async function sync_url(url) {
|
|
|
584
584
|
|
|
585
585
|
if (!start_something()) return
|
|
586
586
|
|
|
587
|
-
await
|
|
587
|
+
await within_fiber(fullpath, async () => {
|
|
588
588
|
var fullpath = await get_fullpath()
|
|
589
589
|
|
|
590
590
|
while (file_needs_reading || file_needs_writing) {
|
|
@@ -888,7 +888,7 @@ async function ensure_path(path) {
|
|
|
888
888
|
var parts = path.split('/').slice(1)
|
|
889
889
|
for (var i = 1; i <= parts.length; i++) {
|
|
890
890
|
var partial = '/' + parts.slice(0, i).join('/')
|
|
891
|
-
await
|
|
891
|
+
await within_fiber(normalize_url(partial), async () => {
|
|
892
892
|
try {
|
|
893
893
|
let stat = await require("fs").promises.stat(partial)
|
|
894
894
|
if (stat.isDirectory()) return // good
|
|
@@ -1025,21 +1025,18 @@ async function set_read_only(fullpath, read_only) {
|
|
|
1025
1025
|
}
|
|
1026
1026
|
}
|
|
1027
1027
|
|
|
1028
|
-
|
|
1029
|
-
if (!
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
}
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
} finally {
|
|
1041
|
-
lock()
|
|
1042
|
-
}
|
|
1028
|
+
function within_fiber(id, func) {
|
|
1029
|
+
if (!within_fiber.chains) within_fiber.chains = {}
|
|
1030
|
+
var prev = within_fiber.chains[id] || Promise.resolve()
|
|
1031
|
+
var curr = prev.then(async () => {
|
|
1032
|
+
try {
|
|
1033
|
+
return await func()
|
|
1034
|
+
} finally {
|
|
1035
|
+
if (within_fiber.chains[id] === curr)
|
|
1036
|
+
delete within_fiber.chains[id]
|
|
1037
|
+
}
|
|
1038
|
+
})
|
|
1039
|
+
return within_fiber.chains[id] = curr
|
|
1043
1040
|
}
|
|
1044
1041
|
|
|
1045
1042
|
async function file_exists(fullpath) {
|