Skip to content

Commit

Permalink
rename option pool.WithQueryMiddleware() to pool.WithAuthorKindQueryM…
Browse files Browse the repository at this point in the history
…iddleware().
  • Loading branch information
fiatjaf committed Jan 3, 2025
1 parent 668720f commit b33cfb1
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions pool.go
Original file line number Diff line number Diff line change
Expand Up @@ -123,9 +123,9 @@ func (h WithEventMiddleware) ApplyPoolOption(pool *SimplePool) {

// WithQueryMiddleware is a function that will be called with every combination of relay+pubkey+kind queried
// in a .SubMany*() call -- when applicable (i.e. when the query contains a pubkey and a kind).
type WithQueryMiddleware func(relay string, pubkey string, kind int)
type WithAuthorKindQueryMiddleware func(relay string, pubkey string, kind int)

func (h WithQueryMiddleware) ApplyPoolOption(pool *SimplePool) {
func (h WithAuthorKindQueryMiddleware) ApplyPoolOption(pool *SimplePool) {
pool.queryMiddleware = h
}

Expand Down Expand Up @@ -508,7 +508,7 @@ func (pool *SimplePool) CountMany(
filter Filter,
opts []SubscriptionOption,
) int {
hll := hyperloglog.New(0) // offset is irrelevant here, so we just pass 0
hll := hyperloglog.New(0) // offset is irrelevant here

wg := sync.WaitGroup{}
wg.Add(len(urls))
Expand Down
2 changes: 1 addition & 1 deletion sdk/system.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ func NewSystem(mods ...SystemModifier) *System {
}

sys.Pool = nostr.NewSimplePool(context.Background(),
nostr.WithQueryMiddleware(sys.TrackQueryAttempts),
nostr.WithAuthorKindQueryMiddleware(sys.TrackQueryAttempts),
nostr.WithEventMiddleware(sys.TrackEventHints),
nostr.WithPenaltyBox(),
)
Expand Down

0 comments on commit b33cfb1

Please sign in to comment.