add some basic sdk tests, fix saving hints (normalize urls), checkduplicates arg order, kvdb stuff and other things.

This commit is contained in:
fiatjaf
2025-01-16 17:38:03 -03:00
parent 46569b6ef4
commit febf022124
15 changed files with 121 additions and 58 deletions

View File

@@ -43,9 +43,8 @@ type System struct {
StoreRelay nostr.RelayStore
replaceableLoaders []*dataloader.Loader[string, *nostr.Event]
addressableLoaders []*dataloader.Loader[string, []*nostr.Event]
outboxShortTermCache cache.Cache32[[]string]
replaceableLoaders []*dataloader.Loader[string, *nostr.Event]
addressableLoaders []*dataloader.Loader[string, []*nostr.Event]
}
type SystemModifier func(sys *System)
@@ -105,14 +104,11 @@ func NewSystem(mods ...SystemModifier) *System {
"wss://search.nos.today",
),
Hints: memoryh.NewHintDB(),
outboxShortTermCache: cache_memory.New32[[]string](1000),
}
sys.Pool = nostr.NewSimplePool(context.Background(),
nostr.WithAuthorKindQueryMiddleware(sys.TrackQueryAttempts),
nostr.WithEventMiddleware(sys.TrackEventHints),
nostr.WithEventMiddleware(sys.TrackEventRelays),
nostr.WithEventMiddleware(sys.TrackEventHintsAndRelays),
nostr.WithDuplicateMiddleware(sys.TrackEventRelaysD),
nostr.WithPenaltyBox(),
)