Use only origin server to speed things up

This commit is contained in:
Neil Alexander 2021-06-30 09:58:33 +01:00
parent 57be026e81
commit f54063a61a
No known key found for this signature in database
GPG key ID: A02A2019A2BB0944

View file

@ -466,21 +466,23 @@ func (t *txnReq) processDeviceListUpdate(ctx context.Context, e gomatrixserverli
} }
} }
func (t *txnReq) getServers(ctx context.Context, roomID string) []gomatrixserverlib.ServerName { func (t *txnReq) getServers(_ context.Context, _ string) []gomatrixserverlib.ServerName {
t.serversMutex.Lock() t.serversMutex.Lock()
defer t.serversMutex.Unlock() defer t.serversMutex.Unlock()
if t.servers != nil { if t.servers != nil {
return t.servers return t.servers
} }
t.servers = []gomatrixserverlib.ServerName{t.Origin} t.servers = []gomatrixserverlib.ServerName{t.Origin}
serverReq := &api.QueryServerJoinedToRoomRequest{ /*
RoomID: roomID, serverReq := &api.QueryServerJoinedToRoomRequest{
} RoomID: roomID,
serverRes := &api.QueryServerJoinedToRoomResponse{} }
if err := t.rsAPI.QueryServerJoinedToRoom(ctx, serverReq, serverRes); err == nil { serverRes := &api.QueryServerJoinedToRoomResponse{}
t.servers = append(t.servers, serverRes.ServerNames...) if err := t.rsAPI.QueryServerJoinedToRoom(ctx, serverReq, serverRes); err == nil {
util.GetLogger(ctx).Infof("Found %d server(s) to query for missing events in %q", len(t.servers), roomID) t.servers = append(t.servers, serverRes.ServerNames...)
} util.GetLogger(ctx).Infof("Found %d server(s) to query for missing events in %q", len(t.servers), roomID)
}
*/
return t.servers return t.servers
} }