MCPcopy
hub / github.com/apache/pouchdb / processPendingBatch

Function processPendingBatch

lib/index.js:9982–10012  ·  view source on GitHub ↗
(immediate)

Source from the content-addressed store, hash-verified

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) {

Callers 4

startNextBatchFunction · 0.70
onChangeFunction · 0.70
onChangesCompleteFunction · 0.70
completeFunction · 0.70

Calls 2

completeReplicationFunction · 0.70
startNextBatchFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…