MCPcopy Index your code
hub / github.com/apache/pouchdb / completeReplication

Function completeReplication

lib/index-browser.js:10000–10037  ·  view source on GitHub ↗
(fatalError)

Source from the content-addressed store, hash-verified

9998
9999
10000 function completeReplication(fatalError) {
10001 if (replicationCompleted) {
10002 return;
10003 }
10004 /* istanbul ignore if */
10005 if (returnValue.cancelled) {
10006 result.status = 'cancelled';
10007 if (writingCheckpoint) {
10008 return;
10009 }
10010 }
10011 result.status = result.status || 'complete';
10012 result.end_time = new Date().toISOString();
10013 result.last_seq = last_seq;
10014 replicationCompleted = true;
10015
10016 src.activeTasks.remove(taskId, fatalError);
10017
10018 if (fatalError) {
10019 // need to extend the error because Firefox considers ".result" read-only
10020 fatalError = createError(fatalError);
10021 fatalError.result = result;
10022
10023 // Normalize error name. i.e. 'Unauthorized' -> 'unauthorized' (eg Sync Gateway)
10024 var errorName = (fatalError.name || '').toLowerCase();
10025 if (errorName === 'unauthorized' || errorName === 'forbidden') {
10026 returnValue.emit('error', fatalError);
10027 returnValue.removeAllListeners();
10028 } else {
10029 backOff(opts, returnValue, fatalError, function () {
10030 replicate(src, target, opts, returnValue);
10031 });
10032 }
10033 } else {
10034 returnValue.emit('complete', result);
10035 returnValue.removeAllListeners();
10036 }
10037 }
10038
10039 function onChange(change, pending, lastSeq) {
10040 /* istanbul ignore if */

Callers 10

writeDocsFunction · 0.70
finishBatchFunction · 0.70
getDiffsFunction · 0.70
processPendingBatchFunction · 0.70
abortReplicationFunction · 0.70
onChangeFunction · 0.70
onChangesCompleteFunction · 0.70
onChangesErrorFunction · 0.70
startChangesFunction · 0.70
replicateFunction · 0.70

Calls 4

createErrorFunction · 0.70
backOffFunction · 0.70
replicateFunction · 0.70
removeMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…