diff options
author | Neil Alexander <neilalexander@users.noreply.github.com> | 2020-03-16 17:29:52 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-03-16 17:29:52 +0000 |
commit | acb505b71751f637531ba9113d4b4daae589bcbc (patch) | |
tree | 06bf9ff06794d9f04bbc637e2feac69c1500d2ee /publicroomsapi | |
parent | 452f393dd7de5203c5cd3ebe5697af6ea0f4b009 (diff) |
Implement gomatrixserverlib.HeaderedEvent in roomserver query API (#912)
* Implement gomatrixserverlib.HeaderedEvent, which should allow us to store room version headers along with the event across API boundaries and consumers/producers, and intercept unmarshalling to get the event structure right
* Add federationsender to previous
Diffstat (limited to 'publicroomsapi')
-rw-r--r-- | publicroomsapi/consumers/roomserver.go | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/publicroomsapi/consumers/roomserver.go b/publicroomsapi/consumers/roomserver.go index 9a817735..2bbd92b7 100644 --- a/publicroomsapi/consumers/roomserver.go +++ b/publicroomsapi/consumers/roomserver.go @@ -22,6 +22,7 @@ import ( "github.com/matrix-org/dendrite/common/config" "github.com/matrix-org/dendrite/publicroomsapi/storage" "github.com/matrix-org/dendrite/roomserver/api" + "github.com/matrix-org/gomatrixserverlib" log "github.com/sirupsen/logrus" sarama "gopkg.in/Shopify/sarama.v1" ) @@ -98,5 +99,13 @@ func (s *OutputRoomEventConsumer) onMessage(msg *sarama.ConsumerMessage) error { return err } - return s.db.UpdateRoomFromEvents(context.TODO(), addQueryRes.Events, remQueryRes.Events) + var addQueryEvents, remQueryEvents []gomatrixserverlib.Event + for _, headeredEvent := range addQueryRes.Events { + addQueryEvents = append(addQueryEvents, headeredEvent.Event) + } + for _, headeredEvent := range remQueryRes.Events { + remQueryEvents = append(remQueryEvents, headeredEvent.Event) + } + + return s.db.UpdateRoomFromEvents(context.TODO(), addQueryEvents, remQueryEvents) } |