code: func (s *StanServer) removeAllNonDurableSubscribers(client *client) {
  	// client has been unregistered and no other routine can add/remove
  	// subscriptions, so it is safe to use the original.
  	client.RLock()
  	subs := client.subs
  	clientID := client.info.ID
  	client.RUnlock()
  	var (
  		storesToFlush = map[string]stores.SubStore{}
  		channels      = map[string]struct{}{}
  	)
  	for _, sub := range subs {
  		sub.RLock()
  		subject := sub.subject
  		isDurable := sub.IsDurable
  		subStore := sub.store
  		sub.RUnlock()
  		// Get the channel
  		c := s.channels.get(subject)
  		if c == nil {
  			continue
  		}
  		// Don't remove durables
  		c.ss.Remove(c, sub, false)
  		// If the sub is a durable, there may have been an update to storage,
  		// so we will want to flush the store. In clustering, during replay,
  		// subStore may be nil.
  		if isDurable && subStore != nil {
  			storesToFlush[subject] = subStore
  		}
  		channels[subject] = struct{}{}
  	}
  	if len(storesToFlush) > 0 {
  		for subject, subStore := range storesToFlush {
  			if err := subStore.Flush(); err != nil {
  				s.log.Errorf("[Client:%s] Error flushing store while removing subscriptions: subject=%s, err=%v", clientID, subject, err)
  			}
  		}
  	}
  	for channel := range channels {
  		s.channels.maybeStartChannelDeleteTimer(channel, nil)
  	}
  }
docs: // removeAllNonDurableSubscribers will remove all non-durable subscribers for the client.