Merge branch 'main' into dev

This commit is contained in:
Derek Collison
2023-04-29 19:52:57 -07:00
24 changed files with 2757 additions and 2310 deletions

View File

@@ -677,7 +677,7 @@ func (mset *stream) addConsumerWithAssignment(config *ConsumerConfig, oname stri
mset.mu.Lock()
if mset.client == nil || mset.store == nil || mset.consumers == nil {
mset.mu.Unlock()
return nil, errors.New("invalid stream")
return nil, NewJSStreamInvalidError()
}
// If this one is durable and already exists, we let that be ok as long as only updating what should be allowed.
@@ -4674,6 +4674,13 @@ func (o *consumer) delete() error {
return o.stopWithFlags(true, false, true, true)
}
// To test for closed state.
func (o *consumer) isClosed() bool {
o.mu.RLock()
defer o.mu.RUnlock()
return o.closed
}
func (o *consumer) stopWithFlags(dflag, sdflag, doSignal, advisory bool) error {
o.mu.Lock()
js := o.js