nostrdb

an unfairly fast embedded nostr database backed by lmdb
git clone git://jb55.com/nostrdb
Log | Files | Refs | Submodules | README | LICENSE

commit 18c75b5c64664e012cdc17abadf4a300556a89d7
parent 3044c090557d76022ceefe7c34f1732e31eb7f47
Author: William Casarin <jb55@jb55.com>
Date:   Wed,  3 Jan 2024 14:44:06 -0800

debug: add a few more debug statement

Diffstat:
Msrc/nostrdb.c | 13+++++++------
1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/src/nostrdb.c b/src/nostrdb.c @@ -1790,7 +1790,7 @@ static int ndb_ingester_process_event(secp256k1_context *ctx, if ((int)note_size == -42) { // we already have this! - //ndb_debug("already have id??\n"); + ndb_debug("already have id??\n"); goto cleanup; } else if (note_size == 0) { ndb_debug("failed to parse '%.*s'\n", ev->len, ev->json); @@ -1810,6 +1810,7 @@ static int ndb_ingester_process_event(secp256k1_context *ctx, if (!ndb_ingester_process_note(ctx, note, note_size, out, ingester)) { + ndb_debug("failed to process note\n"); goto cleanup; } else { // we're done with the original json, free it @@ -1831,6 +1832,7 @@ static int ndb_ingester_process_event(secp256k1_context *ctx, if (!ndb_ingester_process_note(ctx, note, note_size, out, ingester)) { + ndb_debug("failed to process note\n"); goto cleanup; } else { // we're done with the original json, free it @@ -2925,7 +2927,7 @@ static void *ndb_writer_thread(void *data) txn.mdb_txn = NULL; num_notes = 0; popped = prot_queue_pop_all(&writer->inbox, msgs, THREAD_QUEUE_BATCH); - //ndb_debug("writer popped %d items\n", popped); + ndb_debug("writer popped %d items\n", popped); any_note = 0; for (i = 0 ; i < popped; i++) { @@ -2971,7 +2973,6 @@ static void *ndb_writer_thread(void *data) scratch, scratch_size); - ndb_debug("note_nkey %" PRIu64 "\n", note_nkey); if (note_nkey > 0) { written_notes[num_notes++] = (struct written_note){ .note_id = note_nkey, @@ -3000,7 +3001,7 @@ static void *ndb_writer_thread(void *data) if (!ndb_end_query(&txn)) { ndb_debug("writer thread txn commit failed\n"); } else { - ndb_debug("notifying subscriptions\n"); + ndb_debug("notifying subscriptions, %d notes\n", num_notes); ndb_notify_subscriptions(writer->monitor, written_notes, num_notes); @@ -3048,7 +3049,7 @@ static void *ndb_ingester_thread(void *data) any_event = 0; popped = prot_queue_pop_all(&thread->inbox, msgs, THREAD_QUEUE_BATCH); - //ndb_debug("ingester popped %d items\n", popped); + ndb_debug("ingester popped %d items\n", popped); for (i = 0; i < popped; i++) { msg = &msgs[i]; @@ -3086,7 +3087,7 @@ static void *ndb_ingester_thread(void *data) mdb_txn_abort(read_txn); if (to_write > 0) { - //ndb_debug("pushing %d events to write queue\n", to_write); + ndb_debug("pushing %d events to write queue\n", to_write); if (!ndb_writer_queue_msgs(ingester->writer, outs, to_write)) { ndb_debug("failed pushing %d events to write queue\n", to_write); }