diff options
author | Kegsay <kegan@matrix.org> | 2020-08-06 17:48:10 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-08-06 17:48:10 +0100 |
commit | 32a4565b556b55b6dfe6e8f66dc2fe75a2b8d84b (patch) | |
tree | b2adca98a17da0ac6b6bc446e5c1eb362a9f9130 /keyserver/keyserver.go | |
parent | b7491aae03324b722042ab685013003ad483d401 (diff) |
Add device list updater which manages updating remote device lists (#1242)
* Add device list updater which manages updating remote device lists
- Doesn't persist stale lists to the database yet
- Doesn't have tests yet
* Mark device lists as fresh when we persist
Diffstat (limited to 'keyserver/keyserver.go')
-rw-r--r-- | keyserver/keyserver.go | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/keyserver/keyserver.go b/keyserver/keyserver.go index 79d9cec9..4a6fbe3c 100644 --- a/keyserver/keyserver.go +++ b/keyserver/keyserver.go @@ -15,8 +15,6 @@ package keyserver import ( - "sync" - "github.com/Shopify/sarama" "github.com/gorilla/mux" "github.com/matrix-org/dendrite/internal/config" @@ -52,12 +50,16 @@ func NewInternalAPI( Producer: producer, DB: db, } + updater := internal.NewDeviceListUpdater(db, keyChangeProducer, fedClient, 8) // 8 workers TODO: configurable + err = updater.Start() + if err != nil { + logrus.WithError(err).Panicf("failed to start device list updater") + } return &internal.KeyInternalAPI{ - DB: db, - ThisServer: cfg.Matrix.ServerName, - FedClient: fedClient, - Producer: keyChangeProducer, - Mutex: &sync.Mutex{}, - UserIDToMutex: make(map[string]*sync.Mutex), + DB: db, + ThisServer: cfg.Matrix.ServerName, + FedClient: fedClient, + Producer: keyChangeProducer, + Updater: updater, } } |