Skip to content

Commit

Permalink
Simplify checking for o.subjf len
Browse files Browse the repository at this point in the history
Signed-off-by: Tomasz Pietrek <tomasz@nats.io>
  • Loading branch information
Jarema committed May 31, 2023
1 parent 52faae9 commit ed52a36
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions server/consumer.go
Expand Up @@ -3252,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 || len(o.subjf) == 0 {
if len(o.subjf) == 0 {
// Grab next message applicable to us.
// We will unlock here in case lots of contention, e.g. WQ.
o.mu.Unlock()
Expand Down Expand Up @@ -3313,7 +3313,7 @@ func (o *consumer) getNextMsg() (*jsPubMsg, uint64, error) {
// even if len == 0 or 1.
// TODO(tp): we should have sort based off generics for server
// to avoid reflection.
if o.subjf != nil && len(o.subjf) > 1 {
if len(o.subjf) > 1 {
sort.Slice(o.subjf, func(i, j int) bool {
if o.subjf[j].pmsg != nil && o.subjf[i].pmsg == nil {
return false
Expand Down

0 comments on commit ed52a36

Please sign in to comment.