Check in initial pending if our filtered subject directly matches our stream config.

Signed-off-by: Derek Collison <derek@nats.io>
This commit is contained in:
Derek Collison
2021-03-13 19:59:21 -08:00
parent 6241ef2d41
commit 10afedcc46

View File

@@ -2729,8 +2729,18 @@ func (o *consumer) setInitialPending() {
if mset == nil {
return
}
// Non-filtering, means we want all messages.
if o.cfg.FilterSubject == _EMPTY_ {
// notFiltered means we want all messages.
notFiltered := o.cfg.FilterSubject == _EMPTY_
if !notFiltered {
// Check to see if we directly match the configured stream.
// Many clients will always send a filtered subject.
cfg := mset.config()
if len(cfg.Subjects) == 1 && cfg.Subjects[0] == o.cfg.FilterSubject {
notFiltered = true
}
}
if notFiltered {
state := mset.store.State()
if state.Msgs > 0 {
o.sgap = state.Msgs - (o.sseq - state.FirstSeq)