...
 
Commits (5)
......@@ -3,6 +3,8 @@
seem = require 'seem'
delay = 2000
`replicate(source,target,name,extensions)`: replicate database `name` from `source` to `target` (all strings) by creating a replication `pull` document on the target.
Before submission, the replication document is passed to the (optional) `extensions` callback.
Returns a Promise. Make sure you `catch()` any errors.
......@@ -89,7 +91,7 @@ When using the deletion method, first delete the existing replication document.
Give CouchDB some time to breath.
yield delay 2000
yield sleep delay
Update the replication document.
......@@ -107,7 +109,7 @@ Update the replication document.
yield replicator
.put doc
.catch (error) ->
debug "put #{model._id}: #{error.stack ? error}"
debug.error "put #{model._id}", error
Catch 403 errors as they indicate the status was updated by CouchDB (too fast for us to see).
......@@ -117,12 +119,12 @@ Catch 403 errors as they indicate the status was updated by CouchDB (too fast fo
Report all other errors.
debug "Replication from #{model.source} failed."
debug.error "Replication from #{model.source} failed.", error
Promise.reject error
Give CouchDB some time to breath.
yield delay 2000
yield sleep delay
Log the status of the replicator
......@@ -140,7 +142,7 @@ Toolbox
PouchDB = require 'ccnq4-pouchdb'
.plugin require 'pouchdb-replication'
delay = require 'timeout-as-promise'
sleep = (timeout) -> new Promise (resolve) -> setTimeout resolve, timeout
crypto = require 'crypto'
url = require 'url'
pkg = require './package.json'
......
This diff is collapsed.
{
"name": "frantic-team",
"version": "1.2.3",
"version": "1.2.4",
"description": "Inject replication documents in CouchDB",
"main": "index.js",
"scripts": {
......@@ -24,16 +24,15 @@
},
"homepage": "https://github.com/shimaore/frantic-team",
"devDependencies": {
"chai": "^4.1.1",
"chai": "^4.1.2",
"coffee-coverage": "^2.0.1",
"coffee-script": "^1.12.7",
"mocha": "^3.5.0"
"mocha": "^4.0.1"
},
"dependencies": {
"ccnq4-pouchdb": "^1.0.0",
"pouchdb-replication": "^6.3.4",
"seem": "^2.0.0",
"tangible": "^1.9.0",
"timeout-as-promise": "^1.0.0"
"tangible": "^1.9.0"
}
}