From 0012a454889b5ca2666e42710ff112a7a8553a68 Mon Sep 17 00:00:00 2001 From: fiatjaf Date: Thu, 26 Sep 2024 21:49:41 -0300 Subject: [PATCH] label our submany queries. --- nostr.go | 22 +++++++++++++--------- opengraph_test.go | 1 - 2 files changed, 13 insertions(+), 10 deletions(-) diff --git a/nostr.go b/nostr.go index 6dedbdc..b320c78 100644 --- a/nostr.go +++ b/nostr.go @@ -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 { diff --git a/opengraph_test.go b/opengraph_test.go index cd16fe4..44fb7a9 100644 --- a/opengraph_test.go +++ b/opengraph_test.go @@ -25,7 +25,6 @@ type OpengraphFields struct { } func TestMain(m *testing.M) { - initCache() code := m.Run() os.Exit(code) }