Skip to content

Commit

Permalink
Fix bug in needAck
Browse files Browse the repository at this point in the history
needAck has reverse logic for checking single subject-single filter
scenario.

Signed-off-by: Tomasz Pietrek <tomasz@nats.io>
  • Loading branch information
Jarema committed Mar 31, 2023
1 parent 6ced966 commit ed6083d
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions server/consumer.go
Expand Up @@ -2570,8 +2570,8 @@ func (o *consumer) isFiltered() bool {
// as any checks as possible to avoid unnecessary work.
// Here we avoid iteration over slices if there is only one subject in stream
// and one equal filter for the consumer.
if len(mset.cfg.Subjects) == 1 && len(o.subjf) == 1 && mset.cfg.Subjects[0] == o.subjf[0].subject {
return true
if len(mset.cfg.Subjects) == 1 && len(o.subjf) == 1 {
return mset.cfg.Subjects[0] != o.subjf[0].subject
}

// if the list is not equal length, we can return early, as this is filtered.
Expand Down

0 comments on commit ed6083d

Please sign in to comment.