label our submany queries.

This commit is contained in:
fiatjaf
2024-09-26 21:49:41 -03:00
parent 38557f3e9b
commit 0012a45488
2 changed files with 13 additions and 10 deletions

View File

@@ -158,7 +158,12 @@ func getEvent(ctx context.Context, code string) (*nostr.Event, []string, error)
fetchProfileOnce := sync.Once{}
for ie := range sys.Pool.SubManyEoseNonUnique(subManyCtx, relays, nostr.Filters{filter}) {
for ie := range sys.Pool.SubManyEoseNonUnique(
subManyCtx,
relays,
nostr.Filters{filter},
nostr.WithLabel("fetching "+prefix),
) {
fetchProfileOnce.Do(func() {
go sys.FetchProfileMetadata(ctx, ie.PubKey)
})
@@ -240,7 +245,7 @@ func authorLastNotes(ctx context.Context, pubkey string, isSitemap bool) []Enhan
relays = unique(append(relays, getRandomRelay()))
}
ch := sys.Pool.SubManyEose(ctx, relays, nostr.Filters{filter})
ch := sys.Pool.SubManyEose(ctx, relays, nostr.Filters{filter}, nostr.WithLabel("authorlast"))
out:
for {
select {
@@ -312,13 +317,12 @@ func contactsForPubkey(ctx context.Context, pubkey string) []string {
relays = append(relays, pubkeyRelays...)
relays = append(relays, sys.MetadataRelays...)
ch := sys.Pool.SubManyEose(ctx, relays, nostr.Filters{
{
Kinds: []int{3},
Authors: []string{pubkey},
Limit: 2,
},
})
ch := sys.Pool.SubManyEose(
ctx,
relays,
nostr.Filters{{Kinds: []int{3}, Authors: []string{pubkey}, Limit: 2}},
nostr.WithLabel("contacts"),
)
for {
select {

View File

@@ -25,7 +25,6 @@ type OpengraphFields struct {
}
func TestMain(m *testing.M) {
initCache()
code := m.Run()
os.Exit(code)
}