Skip to content

Commit

Permalink
fix(reconsume): subMsgs should be used instead of msgs in consume gor…
Browse files Browse the repository at this point in the history
…outine (#504)

* fix(consume): subMsgs should be used instead of msgs in consuming goroutine
  • Loading branch information
hzjiangjian committed Jul 8, 2020
1 parent 09c1624 commit 80b3acc
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions consumer/push_consumer.go
Original file line number Diff line number Diff line change
Expand Up @@ -913,7 +913,7 @@ func (pc *pushConsumer) consumeMessageCurrently(pq *processQueue, mq *primitive.
Properties: make(map[string]string),
ConsumerGroup: pc.consumerGroup,
MQ: mq,
Msgs: msgs,
Msgs: subMsgs,
}
ctx := context.Background()
ctx = primitive.WithConsumerCtx(ctx, msgCtx)
Expand Down Expand Up @@ -944,14 +944,14 @@ func (pc *pushConsumer) consumeMessageCurrently(pq *processQueue, mq *primitive.
} else {
increaseConsumeFailedTPS(pc.consumerGroup, mq.Topic, len(subMsgs))
if pc.model == BroadCasting {
for i := 0; i < len(msgs); i++ {
for i := 0; i < len(subMsgs); i++ {
rlog.Warning("BROADCASTING, the message consume failed, drop it", map[string]interface{}{
"message": subMsgs[i],
})
}
} else {
for i := 0; i < len(msgs); i++ {
msg := msgs[i]
for i := 0; i < len(subMsgs); i++ {
msg := subMsgs[i]
if !pc.sendMessageBack(mq.BrokerName, msg, concurrentCtx.DelayLevelWhenNextConsume) {
msg.ReconsumeTimes += 1
msgBackFailed = append(msgBackFailed, msg)
Expand All @@ -973,7 +973,7 @@ func (pc *pushConsumer) consumeMessageCurrently(pq *processQueue, mq *primitive.
} else {
rlog.Warning("processQueue is dropped without process consume result.", map[string]interface{}{
rlog.LogKeyMessageQueue: mq,
"message": msgs,
"message": subMsgs,
})
}
})
Expand Down

0 comments on commit 80b3acc

Please sign in to comment.