| 2412 | callback(err); |
| 2413 | }; |
| 2414 | const onComplete = (resp) => { |
| 2415 | var lastSeq = resp.last_seq; |
| 2416 | Promise.all(promises).then(() => { |
| 2417 | return upsert(this, '_local/compaction', (doc) => { |
| 2418 | if (!doc.last_seq || doc.last_seq < lastSeq) { |
| 2419 | doc.last_seq = lastSeq; |
| 2420 | return doc; |
| 2421 | } |
| 2422 | return false; // somebody else got here first, don't update |
| 2423 | }); |
| 2424 | }).then(() => { |
| 2425 | this.activeTasks.remove(taskId); |
| 2426 | callback(null, {ok: true}); |
| 2427 | }).catch(onError); |
| 2428 | }; |
| 2429 | |
| 2430 | this.info().then((info) => { |
| 2431 | taskId = this.activeTasks.add({ |