mirror of
https://github.com/hoernschen/dendrite.git
synced 2024-12-26 15:08:28 +00:00
Limit number of servers
This commit is contained in:
parent
161857d9b7
commit
1607b8ef78
1 changed files with 6 additions and 0 deletions
|
@ -483,12 +483,14 @@ 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{
|
||||
|
@ -500,6 +502,10 @@ 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 {
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
util.GetLogger(ctx).Infof("Found %d server(s) to query for missing events in %q", len(t.servers), roomID)
|
||||
|
|
Loading…
Reference in a new issue