pubsub: check for termination in UnsubscribeAll (#7820)

This check was correctly handled in Unsubscribe, but not UnsubscribeAll.
This commit is contained in:
M. J. Fromberger
2022-02-14 15:34:35 -08:00
committed by GitHub
parent d3548eb706
commit 44d9e9917c

View File

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