This is an automated email from the ASF dual-hosted git repository.
cserwen pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/rocketmq-client-go.git
The following commit(s) were added to refs/heads/master by this push:
new da20ee7 [ISSUE #1076] fix: sort Topic routing information to ensure
that order messages are sent normally
da20ee7 is described below
commit da20ee7b0743a08ecf1fc53403f530b74eea2257
Author: cserwen <[email protected]>
AuthorDate: Mon Sep 25 17:08:19 2023 +0800
[ISSUE #1076] fix: sort Topic routing information to ensure that order
messages are sent normally
Co-authored-by: dengzhiwen1 <[email protected]>
---
internal/route.go | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/internal/route.go b/internal/route.go
index e077b5f..13ce05c 100644
--- a/internal/route.go
+++ b/internal/route.go
@@ -493,8 +493,9 @@ func (s *namesrvs) routeData2PublishInfo(topic string, data
*TopicRouteData) *To
}
qds := data.QueueDataList
- sort.Slice(qds, func(i, j int) bool {
- return i-j >= 0
+ sort.SliceStable(qds, func(i, j int) bool {
+ // sort by increase
+ return strings.Compare(qds[i].BrokerName, qds[j].BrokerName) < 0
})
for _, qd := range qds {