mirror of
https://github.com/hoernschen/dendrite.git
synced 2025-08-02 14:12:47 +00:00
This PR adds a new consumer for typing notifications in syncapi. It also brings changes to syncserver.go and some related files so EDUs can better fit in /sync responses. Fixes #635. Fixes #574.
This commit is contained in:
parent
f8463063ac
commit
29841bed6b
19 changed files with 712 additions and 252 deletions
|
@ -28,7 +28,6 @@ import (
|
|||
"github.com/matrix-org/dendrite/syncapi/routing"
|
||||
"github.com/matrix-org/dendrite/syncapi/storage"
|
||||
"github.com/matrix-org/dendrite/syncapi/sync"
|
||||
"github.com/matrix-org/dendrite/syncapi/types"
|
||||
)
|
||||
|
||||
// SetupSyncAPIComponent sets up and registers HTTP handlers for the SyncAPI
|
||||
|
@ -39,17 +38,17 @@ func SetupSyncAPIComponent(
|
|||
accountsDB *accounts.Database,
|
||||
queryAPI api.RoomserverQueryAPI,
|
||||
) {
|
||||
syncDB, err := storage.NewSyncServerDatabase(string(base.Cfg.Database.SyncAPI))
|
||||
syncDB, err := storage.NewSyncServerDatasource(string(base.Cfg.Database.SyncAPI))
|
||||
if err != nil {
|
||||
logrus.WithError(err).Panicf("failed to connect to sync db")
|
||||
}
|
||||
|
||||
pos, err := syncDB.SyncStreamPosition(context.Background())
|
||||
pos, err := syncDB.SyncPosition(context.Background())
|
||||
if err != nil {
|
||||
logrus.WithError(err).Panicf("failed to get stream position")
|
||||
logrus.WithError(err).Panicf("failed to get sync position")
|
||||
}
|
||||
|
||||
notifier := sync.NewNotifier(types.StreamPosition(pos))
|
||||
notifier := sync.NewNotifier(pos)
|
||||
err = notifier.Load(context.Background(), syncDB)
|
||||
if err != nil {
|
||||
logrus.WithError(err).Panicf("failed to start notifier")
|
||||
|
@ -71,5 +70,12 @@ func SetupSyncAPIComponent(
|
|||
logrus.WithError(err).Panicf("failed to start client data consumer")
|
||||
}
|
||||
|
||||
typingConsumer := consumers.NewOutputTypingEventConsumer(
|
||||
base.Cfg, base.KafkaConsumer, notifier, syncDB,
|
||||
)
|
||||
if err = typingConsumer.Start(); err != nil {
|
||||
logrus.WithError(err).Panicf("failed to start typing server consumer")
|
||||
}
|
||||
|
||||
routing.Setup(base.APIMux, requestPool, syncDB, deviceDB)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue