Merge pull request #2419 from nats-io/consumer-panic-stream-delete

[FIXED] #2416
This commit is contained in:
Derek Collison
2021-08-07 12:34:53 -07:00
committed by GitHub
2 changed files with 6 additions and 2 deletions

View File

@@ -452,6 +452,10 @@ func (mset *stream) addConsumerWithAssignment(config *ConsumerConfig, oname stri
// Hold mset lock here.
mset.mu.Lock()
if mset.client == nil || mset.store == nil {
mset.mu.Unlock()
return nil, errors.New("invalid stream")
}
// If this one is durable and already exists, we let that be ok as long as the configs match.
if isDurableConsumer(config) {

View File

@@ -964,7 +964,7 @@ func (mset *stream) purge(preq *JSApiStreamPurgeRequest) (purged uint64, err err
mset.mu.Lock()
if mset.client == nil {
mset.mu.Unlock()
return 0, errors.New("stream closed")
return 0, errors.New("invalid stream")
}
// Purge dedupe.
mset.ddmap = nil
@@ -3324,7 +3324,7 @@ func (mset *stream) snapshot(deadline time.Duration, checkMsgs, includeConsumers
mset.mu.RLock()
if mset.client == nil || mset.store == nil {
mset.mu.RUnlock()
return nil, fmt.Errorf("invalid stream")
return nil, errors.New("invalid stream")
}
store := mset.store
mset.mu.RUnlock()