Skip to content

Commit

Permalink
Merge pull request #102 from getAlby/task-sub
Browse files Browse the repository at this point in the history
chore: check if subscription exists before unsubscribing
  • Loading branch information
im-adithya authored Jul 31, 2024
2 parents 9fe2aae + 6d39611 commit 028f79f
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 028f79f

Please sign in to comment.