[IMPROVED] Single subject in FilterSubjects field#7856
Conversation
neilalexander
left a comment
There was a problem hiding this comment.
Would it better to gate on o.filters.Count() at the callsite of LoadNextMsg/LoadNextMsgMulti instead? That way we get the same optimisation for both SubjectFilter = "foo" and SubjectFilters = []string{"foo"}.
In essence setting All callsites of |
server/consumer.go
Outdated
| // If we have multiple filter subjects, create a sublist which we will use | ||
| // in calling store.LoadNextMsgMulti. | ||
| if len(o.cfg.FilterSubjects) > 0 { | ||
| if len(o.subjf) == 1 { |
There was a problem hiding this comment.
Done, also changed the else if to just an else.
Signed-off-by: Maurice van Veen <github@mauricevanveen.com>
aa945f1 to
263ef9b
Compare
Review of the performance fix that prevents single-entry FilterSubjects from populating o.filters, which would incorrectly route to the slower LoadNextMsgMulti code path instead of LoadNextMsg. https://claude.ai/code/session_016j2QjHeW4iRrcc6obkni4A
We would populate
o.filterseven ifFilterSubjectshas a single entry, which would make us useLoadNextMsgMultiversusLoadNextMsg.o.updateConfigwould already correctly populateo.subjfando.filtersin the same way.Resolves #7852
Signed-off-by: Maurice van Veen github@mauricevanveen.com