Skip to content

Commit

Permalink
chore: check if subscription exists before unsubscribing
Browse files Browse the repository at this point in the history
  • Loading branch information
im-adithya committed Jul 31, 2024
1 parent 9fe2aae commit 6d39611
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion internal/nostr/nostr.go
Original file line number Diff line number Diff line change
Expand Up @@ -809,7 +809,10 @@ func (svc *Service) handleResponseEvent(event *nostr.Event, subscription *Subscr
subscription.EventChan <- event
}
svc.subscriptionsMutex.Lock()
svc.subscriptions[subscription.Uuid].Unsub()
sub, exists := svc.subscriptions[subscription.Uuid]
if exists {
sub.Unsub()
}
svc.subscriptionsMutex.Unlock()
}

Expand Down

0 comments on commit 6d39611

Please sign in to comment.