修复高并发(1K)下的一些问题
This commit is contained in:
1 parent
be737e45e9
commit
c4fa288b93
13 files changed
+194
-213
No files matched your search
@@ -422,7 +422,7 @@ func (s *DiscoveryService) getRandomServerInstance(instMap *sync.Map) *ServerIns
|
||||
instList = append(instList, value.(*ServerInstance))
|
||||
return true
|
||||
})
|
||||
sort.SliceStable(instList, func(i, j int) bool {
|
||||
sort.Slice(instList, func(i, j int) bool {
|
||||
return instList[i].appId < instList[j].appId
|
||||
})
|
||||
index := random.GetRandomInt32(0, int32(len(instList)-1))
|
||||
@@ -436,7 +436,7 @@ func (s *DiscoveryService) getMinLoadServerInstance(instMap *sync.Map) *ServerIn
|
||||
instList = append(instList, value.(*ServerInstance))
|
||||
return true
|
||||
})
|
||||
sort.SliceStable(instList, func(i, j int) bool {
|
||||
sort.Slice(instList, func(i, j int) bool {
|
||||
return instList[i].appId < instList[j].appId
|
||||
})
|
||||
minLoadInstIndex := 0
|
||||
|
||||
Reference in new issue
Block a user