eventstore/lmdb: remove unused lastIdx code.

This commit is contained in:
fiatjaf
2026-04-08 21:45:10 -03:00
parent 9bf9816c15
commit 0152341144
-26
View File
@@ -4,7 +4,6 @@ import (
"encoding/binary"
"fmt"
"os"
"sync/atomic"
"fiatjaf.com/nostr"
"fiatjaf.com/nostr/eventstore"
@@ -34,8 +33,6 @@ type LMDBBackend struct {
hllCache lmdb.DBI
EnableHLLCacheFor func(kind nostr.Kind) (useCache bool, skipSavingActualEvent bool)
lastId atomic.Uint32
}
func (b *LMDBBackend) Init() error {
@@ -186,28 +183,5 @@ func (b *LMDBBackend) initialize() error {
return err
}
// get lastId
if err := b.lmdbEnv.View(func(txn *lmdb.Txn) error {
txn.RawRead = true
cursor, err := txn.OpenCursor(b.rawEventStore)
if err != nil {
return err
}
defer cursor.Close()
k, _, err := cursor.Get(nil, nil, lmdb.Last)
if lmdb.IsNotFound(err) {
// nothing found, so we're at zero
return nil
}
if err != nil {
return err
}
b.lastId.Store(binary.BigEndian.Uint32(k))
return nil
}); err != nil {
return err
}
return b.migrate()
}