From b6a95e46db6a6c8fdb6aab71493d79a200786fbf Mon Sep 17 00:00:00 2001 From: fiatjaf Date: Tue, 3 Oct 2023 15:40:26 -0300 Subject: [PATCH] fix unwanted chaining of canceled contexts. --- data.go | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/data.go b/data.go index 233082f..cc0f0f5 100644 --- a/data.go +++ b/data.go @@ -93,20 +93,22 @@ func grabData(ctx context.Context, code string, isProfileSitemap bool) (*Data, e key = "ln:" + event.PubKey } - rawAuthorRelays := []string{} - ctx, cancel := context.WithTimeout(ctx, time.Second*4) - rawAuthorRelays = relaysForPubkey(ctx, event.PubKey) - cancel() - for _, relay := range rawAuthorRelays { - for _, excluded := range excludedRelays { - if strings.Contains(relay, excluded) { - continue + { + rawAuthorRelays := []string{} + ctx, cancel := context.WithTimeout(ctx, time.Second*4) + rawAuthorRelays = relaysForPubkey(ctx, event.PubKey) + cancel() + for _, relay := range rawAuthorRelays { + for _, excluded := range excludedRelays { + if strings.Contains(relay, excluded) { + continue + } } + if strings.Contains(relay, "/npub1") { + continue // Skip relays with personalyzed query like filter.nostr.wine + } + authorRelays = append(authorRelays, trimProtocol(relay)) } - if strings.Contains(relay, "/npub1") { - continue // Skip relays with personalyzed query like filter.nostr.wine - } - authorRelays = append(authorRelays, trimProtocol(relay)) } var lastNotes []*nostr.Event