Skip to content

Commit da20ee7

Browse files
cserwendengzhiwen1
andauthored
[ISSUE apache#1076] fix: sort Topic routing information to ensure that order messages are sent normally
Co-authored-by: dengzhiwen1 <dengzhiwen1@xiaomi.com>
1 parent 5eab91b commit da20ee7

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

internal/route.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -493,8 +493,9 @@ func (s *namesrvs) routeData2PublishInfo(topic string, data *TopicRouteData) *To
493493
}
494494

495495
qds := data.QueueDataList
496-
sort.Slice(qds, func(i, j int) bool {
497-
return i-j >= 0
496+
sort.SliceStable(qds, func(i, j int) bool {
497+
// sort by increase
498+
return strings.Compare(qds[i].BrokerName, qds[j].BrokerName) < 0
498499
})
499500

500501
for _, qd := range qds {

0 commit comments

Comments
 (0)