braidfs 0.0.74 → 0.0.75
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 +13 -2
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -721,7 +721,7 @@ async function proxy_url(url) {
|
|
|
721
721
|
return
|
|
722
722
|
}
|
|
723
723
|
|
|
724
|
-
var
|
|
724
|
+
var in_parallel = create_parallel_promises(10)
|
|
725
725
|
braid_text.get(url, braid_text_get_options = {
|
|
726
726
|
parents: r.headers.get('version') && JSON.parse(`[${r.headers.get('version')}]`),
|
|
727
727
|
merge_type: 'dt',
|
|
@@ -729,7 +729,7 @@ async function proxy_url(url) {
|
|
|
729
729
|
subscribe: async (u) => {
|
|
730
730
|
if (u.version.length) {
|
|
731
731
|
self.signal_file_needs_writing()
|
|
732
|
-
|
|
732
|
+
in_parallel(() => send_out({...u, peer}))
|
|
733
733
|
}
|
|
734
734
|
},
|
|
735
735
|
})
|
|
@@ -924,3 +924,14 @@ async function file_exists(fullpath) {
|
|
|
924
924
|
function sha256(x) {
|
|
925
925
|
return require('crypto').createHash('sha256').update(x).digest('base64')
|
|
926
926
|
}
|
|
927
|
+
|
|
928
|
+
function create_parallel_promises(N) {
|
|
929
|
+
var q = []
|
|
930
|
+
var n = 0
|
|
931
|
+
return async f => {
|
|
932
|
+
q.push(f)
|
|
933
|
+
n++
|
|
934
|
+
while (q.length && n <= N) await q.shift()()
|
|
935
|
+
n--
|
|
936
|
+
}
|
|
937
|
+
}
|