xujianhai666 commented on a change in pull request #319: [ISSUE #317]
fix(message): 错误的 equals实现
URL: https://github.com/apache/rocketmq-client-go/pull/319#discussion_r356375147
##########
File path: consumer/consumer.go
##########
@@ -470,7 +470,7 @@ func (dc *defaultConsumer) lock(mq
*primitive.MessageQueue) bool {
pq.lastConsumeTime = time.Now()
pq.lastLockTime = time.Now()
}
- if _mq.Equals(mq) {
+ if _mq == *mq {
Review comment:
@wenfengwang equals method impl is incorrect. u can see that as bellow:
```
func (mq MessageQueue) Equals(queue *MessageQueue) bool {
// TODO
return mq.BrokerName == queue.BrokerName && mq.Topic == queue.Topic &&
mq.QueueId == mq.QueueId
}
```
the last equal is `mq.QueueId == mq.QueueId`, which is wrong, and with
golang, we can use '==' to check equal when field in obj is plain
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services