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:
parent
8f944f6434
commit
f4e77453cb
5 changed files with 43 additions and 23 deletions
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue