mirror of
https://github.com/aljazceru/njump.git
synced 2026-02-23 06:54:20 +01:00
small context tweaks.
This commit is contained in:
17
nostr.go
17
nostr.go
@@ -132,18 +132,19 @@ func getLastNotes(ctx context.Context, code string) []*nostr.Event {
|
||||
if pp == nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
ctx, cancel := context.WithTimeout(ctx, time.Millisecond*1500)
|
||||
defer cancel()
|
||||
|
||||
relays := pp.Relays
|
||||
for _, relay := range sdk.FetchRelaysForPubkey(ctx, pool, pp.PublicKey, pp.Relays...) {
|
||||
if relay.Outbox {
|
||||
relays = append(relays, relay.URL)
|
||||
|
||||
{
|
||||
ctx, cancel := context.WithTimeout(ctx, time.Millisecond*1500)
|
||||
defer cancel()
|
||||
for _, relay := range sdk.FetchRelaysForPubkey(ctx, pool, pp.PublicKey, pp.Relays...) {
|
||||
if relay.Outbox {
|
||||
relays = append(relays, relay.URL)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ctx, cancel = context.WithTimeout(ctx, time.Second*4)
|
||||
ctx, cancel := context.WithTimeout(ctx, time.Second*4)
|
||||
defer cancel()
|
||||
|
||||
relays = append(relays, getRelay())
|
||||
|
||||
@@ -117,7 +117,10 @@ func render(w http.ResponseWriter, r *http.Request) {
|
||||
} else {
|
||||
typ = "other"
|
||||
}
|
||||
author, _ = getEvent(r.Context(), npub)
|
||||
|
||||
ctx, cancel := context.WithTimeout(r.Context(), time.Second*3)
|
||||
author, _ = getEvent(ctx, npub)
|
||||
cancel()
|
||||
}
|
||||
|
||||
kindDescription := kindNames[event.Kind]
|
||||
|
||||
Reference in New Issue
Block a user