This commit is contained in:
Neil Alexander 2021-06-22 11:24:27 +01:00
parent 1607b8ef78
commit f6b68b4c4b
No known key found for this signature in database
GPG key ID: A02A2019A2BB0944

View file

@ -483,14 +483,12 @@ func (t *txnReq) getServers(ctx context.Context, roomID string, eventOrigin goma
return t.servers
}
dedupe := map[gomatrixserverlib.ServerName]struct{}{}
count := 1
t.servers = []gomatrixserverlib.ServerName{t.Origin} // transaction origin
dedupe[t.Origin] = struct{}{}
if eventOrigin != "" {
if _, ok := dedupe[eventOrigin]; !ok {
t.servers = append(t.servers, eventOrigin) // event origin, if specified
dedupe[eventOrigin] = struct{}{}
count++
}
}
serverReq := &api.QueryServerJoinedToRoomRequest{
@ -502,8 +500,7 @@ func (t *txnReq) getServers(ctx context.Context, roomID string, eventOrigin goma
if _, ok := dedupe[server]; !ok {
t.servers = append(t.servers, server)
dedupe[server] = struct{}{}
count++
if count == 10 {
if len(t.servers) == 10 {
break
}
}