aboutsummaryrefslogtreecommitdiff
path: root/roomserver/roomserver.go
diff options
context:
space:
mode:
authorKegsay <kegan@matrix.org>2020-10-06 18:09:02 +0100
committerGitHub <noreply@github.com>2020-10-06 18:09:02 +0100
commit0f7e707f399e7f633c58f4e1a5aedc0e45f90241 (patch)
tree3e6722fb086d738d80d140acfdc11433b666d19a /roomserver/roomserver.go
parent4feff8e8d9efd36b5d202ba219af997a8313866a (diff)
Optimise servers to backfill from (#1485)
- Prefer perspective servers if they are in the room. - Limit the number of backfill servers to 5 to avoid taking too long.
Diffstat (limited to 'roomserver/roomserver.go')
-rw-r--r--roomserver/roomserver.go7
1 files changed, 6 insertions, 1 deletions
diff --git a/roomserver/roomserver.go b/roomserver/roomserver.go
index 2eabf450..98a86e5b 100644
--- a/roomserver/roomserver.go
+++ b/roomserver/roomserver.go
@@ -41,6 +41,11 @@ func NewInternalAPI(
) api.RoomserverInternalAPI {
cfg := &base.Cfg.RoomServer
+ var perspectiveServerNames []gomatrixserverlib.ServerName
+ for _, kp := range base.Cfg.ServerKeyAPI.KeyPerspectives {
+ perspectiveServerNames = append(perspectiveServerNames, kp.ServerName)
+ }
+
roomserverDB, err := storage.Open(&cfg.Database, base.Caches)
if err != nil {
logrus.WithError(err).Panicf("failed to connect to room server db")
@@ -48,6 +53,6 @@ func NewInternalAPI(
return internal.NewRoomserverAPI(
cfg, roomserverDB, base.KafkaProducer, string(cfg.Matrix.Kafka.TopicFor(config.TopicOutputRoomEvent)),
- base.Caches, keyRing,
+ base.Caches, keyRing, perspectiveServerNames,
)
}