@nxtedition/lib 20.1.1 → 20.1.2

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.
Files changed (2) hide show
  1. package/couch.js +14 -3
  2. package/package.json +1 -1
package/couch.js CHANGED
@@ -230,10 +230,11 @@ export function makeCouch(opts) {
230
230
  let remaining = Number(limit) || Infinity
231
231
  while (remaining > 0) {
232
232
  let count = 0
233
+ const limit = Math.min(remaining, socketCount)
233
234
  for await (const changes of _changes({
234
235
  live,
235
236
  retry,
236
- limit: Math.min(remaining, socketCount),
237
+ limit,
237
238
  params,
238
239
  method,
239
240
  body,
@@ -263,7 +264,17 @@ export function makeCouch(opts) {
263
264
  }
264
265
  }
265
266
 
266
- async function* _changes({ live, retry, limit, params, method, body, signal, client }) {
267
+ async function* _changes({
268
+ live,
269
+ retry,
270
+ limit,
271
+ params,
272
+ method,
273
+ body,
274
+ signal,
275
+ client,
276
+ blocking = live || !limit || limit > 256,
277
+ }) {
267
278
  let retryCount = 0
268
279
  let remaining = Number(limit) || Infinity
269
280
  while (true) {
@@ -280,7 +291,7 @@ export function makeCouch(opts) {
280
291
  origin: dbOrigin,
281
292
  query,
282
293
  idempotent: false,
283
- blocking: true,
294
+ blocking,
284
295
  method,
285
296
  body: JSON.stringify(body),
286
297
  signal,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nxtedition/lib",
3
- "version": "20.1.1",
3
+ "version": "20.1.2",
4
4
  "license": "MIT",
5
5
  "author": "Robert Nagy <robert.nagy@boffins.se>",
6
6
  "type": "module",