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