couchdb-bulk2
Advanced tools
Comparing version 2.1.0 to 2.2.0
# CHANGELOG | ||
*versions follow [SemVer](http://semver.org)* | ||
## 2.2.0 - 2021-04-23 | ||
* Added a `-s, --sleep <milliseconds>` option | ||
## 2.1.0 - 2021-04-23 | ||
@@ -5,0 +8,0 @@ * Added a `-l, --batch-length <number>` option |
@@ -10,2 +10,3 @@ #!/usr/bin/env node | ||
.option('-l, --batch-length <number>', 'set the number of documents to be sent in bulk to CouchDB per batch (default: 1000)') | ||
.option('-s, --sleep <milliseconds>', 'defines the amount of time (in milliseconds) to wait once a batch was sent before sending a new one (default: 0)') | ||
.version(version) | ||
@@ -40,3 +41,3 @@ | ||
let docsPerBulk = 1000 | ||
const { batchLength } = program.opts() | ||
const { batchLength, sleep } = program.opts() | ||
if (batchLength) { | ||
@@ -60,2 +61,4 @@ docsPerBulk = parseInt(batchLength) | ||
const wait = ms => new Promise(resolve => setTimeout(resolve, ms)) | ||
let batch = [] | ||
@@ -77,2 +80,3 @@ | ||
await bulkPost(batchToPost) | ||
if (sleep) await wait(sleep) | ||
this.resume() | ||
@@ -79,0 +83,0 @@ } catch (err) { |
{ | ||
"name": "couchdb-bulk2", | ||
"version": "2.1.0", | ||
"version": "2.2.0", | ||
"description": "Pipe newline-delimited JSON into CouchDB", | ||
@@ -5,0 +5,0 @@ "main": "cli.js", |
@@ -51,4 +51,5 @@ # couchdb-bulk2 | ||
* `-l, --batch-length <number>`: set the number of documents to be sent in bulk to CouchDB per batch (default: 1000) | ||
* `-s, --sleep <milliseconds>`: defines the amount of time (in milliseconds) to wait once a batch was sent before sending a new one (default: 0) | ||
## See also | ||
* `couchdb-bulk2` works great in combinaison with [`ndjson-apply`](https://github.com/maxlath/ndjson-apply): see [data transformation workflow in the Inventaire project](https://github.com/inventaire/inventaire/blob/master/docs/data_transformation.md#data-transformation) |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
7567
94
54