diff options
author | Kegsay <kegan@matrix.org> | 2020-07-30 11:15:46 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-07-30 11:15:46 +0100 |
commit | 9355fb5ac8c911bdbde6dcc0f279f716d8a8f60b (patch) | |
tree | c6a155f7b65e25c8ab4abaf7413fbb0531a02b12 /syncapi/syncapi.go | |
parent | 0fdd4f14d123e76bd3d0368947d3aab84a787946 (diff) |
Hook up device list updates to the sync notifier (#1231)
* WIP hooking up key changes
* Fix import cycle, get tests passing and binary compiling
* Linting and update whitelist
Diffstat (limited to 'syncapi/syncapi.go')
-rw-r--r-- | syncapi/syncapi.go | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/syncapi/syncapi.go b/syncapi/syncapi.go index caf91e27..754cd502 100644 --- a/syncapi/syncapi.go +++ b/syncapi/syncapi.go @@ -21,7 +21,9 @@ import ( "github.com/gorilla/mux" "github.com/sirupsen/logrus" + currentstateapi "github.com/matrix-org/dendrite/currentstateserver/api" "github.com/matrix-org/dendrite/internal/config" + keyapi "github.com/matrix-org/dendrite/keyserver/api" "github.com/matrix-org/dendrite/roomserver/api" userapi "github.com/matrix-org/dendrite/userapi/api" "github.com/matrix-org/gomatrixserverlib" @@ -39,6 +41,8 @@ func AddPublicRoutes( consumer sarama.Consumer, userAPI userapi.UserInternalAPI, rsAPI api.RoomserverInternalAPI, + keyAPI keyapi.KeyInternalAPI, + currentStateAPI currentstateapi.CurrentStateInternalAPI, federation *gomatrixserverlib.FederationClient, cfg *config.Dendrite, ) { @@ -58,7 +62,7 @@ func AddPublicRoutes( logrus.WithError(err).Panicf("failed to start notifier") } - requestPool := sync.NewRequestPool(syncDB, notifier, userAPI) + requestPool := sync.NewRequestPool(syncDB, notifier, userAPI, keyAPI, currentStateAPI) roomConsumer := consumers.NewOutputRoomEventConsumer( cfg, consumer, notifier, syncDB, rsAPI, @@ -88,5 +92,13 @@ func AddPublicRoutes( logrus.WithError(err).Panicf("failed to start send-to-device consumer") } + keyChangeConsumer := consumers.NewOutputKeyChangeEventConsumer( + cfg.Matrix.ServerName, string(cfg.Kafka.Topics.OutputKeyChangeEvent), + consumer, notifier, keyAPI, currentStateAPI, syncDB, + ) + if err = keyChangeConsumer.Start(); err != nil { + logrus.WithError(err).Panicf("failed to start key change consumer") + } + routing.Setup(router, requestPool, syncDB, userAPI, federation, rsAPI, cfg) } |