diff --git a/nostr.go b/nostr.go index 51e0ac2..82c1362 100644 --- a/nostr.go +++ b/nostr.go @@ -172,7 +172,9 @@ func relaysForPubkey(ctx context.Context, pubkey string, extraRelays ...string) } } cancel() - cache.SetJSONWithTTL("io:"+pubkey, pubkeyRelays, time.Hour*24*7) + if len(pubkeyRelays) > 0 { + cache.SetJSONWithTTL("io:"+pubkey, pubkeyRelays, time.Hour*24*7) + } } return pubkeyRelays } diff --git a/render.go b/render.go index 38955a5..04ca041 100644 --- a/render.go +++ b/render.go @@ -107,7 +107,9 @@ func render(w http.ResponseWriter, r *http.Request) { ctx, cancel := context.WithTimeout(r.Context(), time.Second*4) lastNotes = getLastNotes(ctx, code, events_num) cancel() - cache.SetJSONWithTTL(key, lastNotes, time.Hour*24) + if len(lastNotes) > 0 { + cache.SetJSONWithTTL(key, lastNotes, time.Hour*24) + } } renderableLastNotes = make([]*Event, len(lastNotes))