Skip to content
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

(2.11) Internal: Intra-Process Queue fixes/improvements. #5895

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions server/consumer.go
Original file line number Diff line number Diff line change
Expand Up @@ -3958,12 +3958,12 @@ func (o *consumer) processInboundAcks(qch chan struct{}) {
for {
select {
case <-o.ackMsgs.ch:
acks := o.ackMsgs.pop()
acks, ql, qsz := o.ackMsgs.pop()
for _, ack := range acks {
o.processAck(ack.subject, ack.reply, ack.hdr, ack.msg)
ack.returnToPool()
}
o.ackMsgs.recycle(&acks)
o.ackMsgs.recycle(acks, ql, qsz)
// If we have an inactiveThreshold set, mark our activity.
if hasInactiveThresh {
o.suppressDeletion()
Expand All @@ -3988,12 +3988,12 @@ func (o *consumer) processInboundNextMsgReqs(qch chan struct{}) {
for {
select {
case <-o.nextMsgReqs.ch:
reqs := o.nextMsgReqs.pop()
reqs, ql, qsz := o.nextMsgReqs.pop()
for _, req := range reqs {
o.processNextMsgRequest(req.reply, req.msg)
req.returnToPool()
}
o.nextMsgReqs.recycle(&reqs)
o.nextMsgReqs.recycle(reqs, ql, qsz)
case <-qch:
return
case <-s.quitCh:
Expand Down
10 changes: 5 additions & 5 deletions server/events.go
Original file line number Diff line number Diff line change
Expand Up @@ -432,13 +432,13 @@ func (s *Server) internalReceiveLoop(recvq *ipQueue[*inSysMsg]) {
for s.eventsRunning() {
select {
case <-recvq.ch:
msgs := recvq.pop()
msgs, ql, qsz := recvq.pop()
for _, m := range msgs {
if m.cb != nil {
m.cb(m.sub, m.c, m.acc, m.subj, m.rply, m.hdr, m.msg)
}
}
recvq.recycle(&msgs)
recvq.recycle(msgs, ql, qsz)
case <-s.quitCh:
return
}
Expand Down Expand Up @@ -477,7 +477,7 @@ RESET:
for s.eventsRunning() {
select {
case <-sendq.ch:
msgs := sendq.pop()
msgs, ql, qsz := sendq.pop()
for _, pm := range msgs {
if si := pm.si; si != nil {
si.Name = servername
Expand Down Expand Up @@ -595,12 +595,12 @@ RESET:
// there is a chance that the process will exit before the
// writeLoop has a chance to send it.
c.flushClients(time.Second)
sendq.recycle(&msgs)
sendq.recycle(msgs, ql, qsz)
return
}
pm.returnToPool()
}
sendq.recycle(&msgs)
sendq.recycle(msgs, ql, qsz)
case <-resetCh:
goto RESET
case <-s.quitCh:
Expand Down
Loading