Add detailed benchmark results for multiple relays.
- Included results for `relayer-basic`, `strfry`, and `nostr-rs-relay` relay benchmarks. - Comprehensive performance metrics added for throughput, latency, query, and concurrent operations. - Reports saved as plain text and AsciiDoc formats.
This commit is contained in:
@@ -2,6 +2,7 @@ package database
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"fmt"
|
||||
|
||||
"github.com/dgraph-io/badger/v4"
|
||||
"lol.mleku.dev/chk"
|
||||
@@ -25,8 +26,23 @@ func (d *D) FetchEventBySerial(ser *types.Uint40) (ev *event.E, err error) {
|
||||
if v, err = item.ValueCopy(nil); chk.E(err) {
|
||||
return
|
||||
}
|
||||
// Check if we have valid data before attempting to unmarshal
|
||||
if len(v) < 32+32+1+2+1+1+64 { // ID + Pubkey + min varint fields + Sig
|
||||
err = fmt.Errorf(
|
||||
"incomplete event data: got %d bytes, expected at least %d",
|
||||
len(v), 32+32+1+2+1+1+64,
|
||||
)
|
||||
return
|
||||
}
|
||||
ev = new(event.E)
|
||||
if err = ev.UnmarshalBinary(bytes.NewBuffer(v)); chk.E(err) {
|
||||
if err = ev.UnmarshalBinary(bytes.NewBuffer(v)); err != nil {
|
||||
// Add more context to EOF errors for debugging
|
||||
if err.Error() == "EOF" {
|
||||
err = fmt.Errorf(
|
||||
"EOF while unmarshaling event (serial=%v, data_len=%d): %w",
|
||||
ser, len(v), err,
|
||||
)
|
||||
}
|
||||
return
|
||||
}
|
||||
return
|
||||
|
||||
Reference in New Issue
Block a user