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

Function doNextCompaction

lib/index.js:1587–1612  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

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