(immediate)
| 9980 | |
| 9981 | |
| 9982 | function processPendingBatch(immediate) { |
| 9983 | if (pendingBatch.changes.length === 0) { |
| 9984 | if (batches.length === 0 && !currentBatch) { |
| 9985 | if ((continuous && changesOpts.live) || changesCompleted) { |
| 9986 | returnValue.state = 'pending'; |
| 9987 | returnValue.emit('paused'); |
| 9988 | } |
| 9989 | if (changesCompleted) { |
| 9990 | completeReplication(); |
| 9991 | } |
| 9992 | } |
| 9993 | return; |
| 9994 | } |
| 9995 | if ( |
| 9996 | immediate || |
| 9997 | changesCompleted || |
| 9998 | pendingBatch.changes.length >= batch_size |
| 9999 | ) { |
| 10000 | batches.push(pendingBatch); |
| 10001 | pendingBatch = { |
| 10002 | seq: 0, |
| 10003 | changes: [], |
| 10004 | docs: [] |
| 10005 | }; |
| 10006 | if (returnValue.state === 'pending' || returnValue.state === 'stopped') { |
| 10007 | returnValue.state = 'active'; |
| 10008 | returnValue.emit('active'); |
| 10009 | } |
| 10010 | startNextBatch(); |
| 10011 | } |
| 10012 | } |
| 10013 | |
| 10014 | |
| 10015 | function abortReplication(reason, err) { |
no test coverage detected
searching dependent graphs…