Browse Source

pubsub: check for termination in UnsubscribeAll (#7820)

This check was correctly handled in Unsubscribe, but not UnsubscribeAll.
pull/7823/head
M. J. Fromberger 3 years ago
committed by GitHub
parent
commit
44d9e9917c
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 0 deletions
  1. +3
    -0
      internal/pubsub/pubsub.go

+ 3
- 0
internal/pubsub/pubsub.go View File

@ -281,6 +281,9 @@ func (s *Server) UnsubscribeAll(ctx context.Context, clientID string) error {
s.subs.Lock() s.subs.Lock()
defer s.subs.Unlock() defer s.subs.Unlock()
if s.subs.index == nil {
return ErrServerStopped
}
evict := s.subs.index.findClientID(clientID) evict := s.subs.index.findClientID(clientID)
if len(evict) == 0 { if len(evict) == 0 {
return ErrSubscriptionNotFound return ErrSubscriptionNotFound


Loading…
Cancel
Save