()
| 9959 | } |
| 9960 | |
| 9961 | function startNextBatch() { |
| 9962 | if (returnValue.cancelled || currentBatch) { |
| 9963 | return; |
| 9964 | } |
| 9965 | if (batches.length === 0) { |
| 9966 | processPendingBatch(true); |
| 9967 | return; |
| 9968 | } |
| 9969 | currentBatch = batches.shift(); |
| 9970 | returnValue.emit('checkpoint', { 'start_next_batch': currentBatch.seq }); |
| 9971 | getDiffs() |
| 9972 | .then(getBatchDocs) |
| 9973 | .then(writeDocs) |
| 9974 | .then(finishBatch) |
| 9975 | .then(startNextBatch) |
| 9976 | .catch(function (err) { |
| 9977 | abortReplication('batch processing terminated with error', err); |
| 9978 | }); |
| 9979 | } |
| 9980 | |
| 9981 | |
| 9982 | function processPendingBatch(immediate) { |
no test coverage detected
searching dependent graphs…