@nxtedition/lib 19.8.15 → 19.8.16
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/couch.js +25 -11
- package/package.json +1 -1
package/couch.js
CHANGED
|
@@ -220,17 +220,31 @@ export function makeCouch(opts) {
|
|
|
220
220
|
const limit = options.limit
|
|
221
221
|
|
|
222
222
|
try {
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
223
|
+
// Limit request duration to allow server to load balance.
|
|
224
|
+
const socketCount = 64 * 1024
|
|
225
|
+
let remaining = Number(limit) || Infinity
|
|
226
|
+
while (remaining > 0) {
|
|
227
|
+
let count = 0
|
|
228
|
+
for await (const changes of _changes({
|
|
229
|
+
batched,
|
|
230
|
+
live,
|
|
231
|
+
retry,
|
|
232
|
+
limit: Math.min(remaining, socketCount),
|
|
233
|
+
params,
|
|
234
|
+
method,
|
|
235
|
+
body,
|
|
236
|
+
signal: ac.signal,
|
|
237
|
+
client,
|
|
238
|
+
})) {
|
|
239
|
+
yield changes
|
|
240
|
+
count += changes.length
|
|
241
|
+
remaining -= changes.length
|
|
242
|
+
}
|
|
243
|
+
assert(remaining >= 0)
|
|
244
|
+
if (!live && count < socketCount) {
|
|
245
|
+
return
|
|
246
|
+
}
|
|
247
|
+
}
|
|
234
248
|
} finally {
|
|
235
249
|
ac.abort()
|
|
236
250
|
if (signal) {
|