ensure AddEvent contexts get cleaned so store queries aren't left half-read.

similar to 1196fabb86
This commit is contained in:
fiatjaf 2024-09-12 22:33:53 -03:00
parent 6d827ac89a
commit 18fc0dc1dd

View File

@ -11,6 +11,9 @@ import (
// AddEvent sends an event through then normal add pipeline, as if it was received from a websocket.
func (rl *Relay) AddEvent(ctx context.Context, evt *nostr.Event) (skipBroadcast bool, writeError error) {
ctx, cancel := context.WithCancel(ctx)
defer cancel()
if evt == nil {
return false, errors.New("error: event is nil")
}