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

Function doNextCompaction

lib/index.es.js:1582–1607  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

1580// all compaction is done in a queue, to avoid attaching
1581// too many listeners at once
1582function doNextCompaction(self) {
1583 var task = self._compactionQueue[0];
1584 var opts = task.opts;
1585 var callback = task.callback;
1586 self.get('_local/compaction').catch(function () {
1587 return false;
1588 }).then(function (doc) {
1589 if (doc && doc.last_seq) {
1590 opts.last_seq = doc.last_seq;
1591 }
1592 self._compact(opts, function (err, res$$1) {
1593 /* istanbul ignore if */
1594 if (err) {
1595 callback(err);
1596 } else {
1597 callback(null, res$$1);
1598 }
1599 nextTick(function () {
1600 self._compactionQueue.shift();
1601 if (self._compactionQueue.length) {
1602 doNextCompaction(self);
1603 }
1604 });
1605 });
1606 });
1607}
1608
1609function appendPurgeSeq(db, docId, rev$$1) {
1610 return db.get('_local/purges').then(function (doc) {

Callers 1

_setupMethod · 0.70

Calls 2

getMethod · 0.45
_compactMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…