Speed up start up time by batch querying ACL events (#3334)

This should significantly speed up start up times on servers with many
rooms.
This commit is contained in:
Till 2024-02-21 14:10:22 +01:00 committed by GitHub
parent 8f944f6434
commit f4e77453cb
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 43 additions and 23 deletions

View file

@ -17,6 +17,7 @@ package producers
import (
"encoding/json"
"github.com/matrix-org/dendrite/roomserver/storage/tables"
"github.com/nats-io/nats.go"
log "github.com/sirupsen/logrus"
"github.com/tidwall/gjson"
@ -75,7 +76,13 @@ func (r *RoomEventProducer) ProduceRoomEvents(roomID string, updates []api.Outpu
if eventType == acls.MRoomServerACL && update.NewRoomEvent.Event.StateKeyEquals("") {
ev := update.NewRoomEvent.Event.PDU
defer r.ACLs.OnServerACLUpdate(ev)
strippedEvent := tables.StrippedEvent{
RoomID: ev.RoomID().String(),
EventType: ev.Type(),
StateKey: *ev.StateKey(),
ContentValue: string(ev.Content()),
}
defer r.ACLs.OnServerACLUpdate(strippedEvent)
}
}
logger.Tracef("Producing to topic '%s'", r.Topic)