From c31580a96107f0dd8003516b9bd2c1448e377a92 Mon Sep 17 00:00:00 2001 From: Andre Staltz Date: Tue, 27 Feb 2024 18:03:35 +0200 Subject: [PATCH] add a few code comments --- lib/index.js | 5 +++++ test/del.test.js | 1 + 2 files changed, 6 insertions(+) diff --git a/lib/index.js b/lib/index.js index f2d4c41..fbeb6cb 100644 --- a/lib/index.js +++ b/lib/index.js @@ -273,6 +273,11 @@ function initDB(peer, config) { }) /** + * TODO: To fix. Notice that some synchronous read APIs such as `db.get()`, + * `db.msgs()`, `db.getTangle()` etc may read an *inconsistent* state of the + * `recs` array while rescanning is in progress. This may mean duplicate msgs + * are read. One possible fix for this is to make all public APIs async. + * * @param {CB} cb */ function rescanLogPostCompaction(cb) { diff --git a/test/del.test.js b/test/del.test.js index 87bad07..b82df66 100644 --- a/test/del.test.js +++ b/test/del.test.js @@ -71,6 +71,7 @@ test('del()', async (t) => { await p(peer.db.log.compact)() assert('compacted') + // Delete 4 so we can test that its log offset was updated post-compaction await p(peer.db.del)(msgIDs[4]) {