lmdb/badger: print id on value read error.

This commit is contained in:
fiatjaf
2023-12-22 20:05:25 -03:00
parent 7c2cab73d4
commit 44e9b11673
2 changed files with 3 additions and 5 deletions

View File

@@ -78,9 +78,10 @@ func (b BadgerBackend) QueryEvents(ctx context.Context, filter nostr.Filter) (ch
idx, q.prefix, key, err) idx, q.prefix, key, err)
return return
} }
err = item.Value(func(val []byte) error { item.Value(func(val []byte) error {
evt := &nostr.Event{} evt := &nostr.Event{}
if err := nostr_binary.Unmarshal(val, evt); err != nil { if err := nostr_binary.Unmarshal(val, evt); err != nil {
log.Printf("badger: value read error (id %x): %s\n", val[0:32], err)
return err return err
} }
@@ -91,9 +92,6 @@ func (b BadgerBackend) QueryEvents(ctx context.Context, filter nostr.Filter) (ch
return nil return nil
}) })
if err != nil {
log.Printf("badger: value read error: %s\n", err)
}
} }
}(i, q) }(i, q)
} }

View File

@@ -94,7 +94,7 @@ func (b *LMDBBackend) QueryEvents(ctx context.Context, filter nostr.Filter) (cha
evt := &nostr.Event{} evt := &nostr.Event{}
if err := nostr_binary.Unmarshal(val, evt); err != nil { if err := nostr_binary.Unmarshal(val, evt); err != nil {
log.Printf("lmdb: value read error: %s\n", err) log.Printf("lmdb: value read error (id %x): %s\n", val[0:32], err)
break break
} }