New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve Consumer with multiple subjects #4188
Conversation
6cc9b96
to
33c44c7
Compare
server/consumer.go
Outdated
@@ -3247,7 +3252,7 @@ func (o *consumer) getNextMsg() (*jsPubMsg, uint64, error) { | |||
store := o.mset.store | |||
|
|||
// If no filters are specified, optimize to fetch just non-filtered messages. | |||
if o.subjf == nil { | |||
if o.subjf == nil || len(o.subjf) == 0 { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just do len() since len(nil) is valid.
server/consumer.go
Outdated
@@ -3313,31 +3315,36 @@ func (o *consumer) getNextMsg() (*jsPubMsg, uint64, error) { | |||
// to avoid reflection. | |||
if o.subjf != nil && len(o.subjf) > 1 { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here, just do len.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
ed52a36
to
1c4f664
Compare
Signed-off-by: Tomasz Pietrek <tomasz@nats.io>
Signed-off-by: Tomasz Pietrek <tomasz@nats.io>
Signed-off-by: Tomasz Pietrek <tomasz@nats.io>
1c4f664
to
261f39b
Compare
While adding more complex test scenarios, some issues in multiple-filters approach surfaced.
This PR adds those tests and addresses the issues.
Signed-off-by: Tomasz Pietrek tomasz@nats.io