mirror of
https://github.com/element-hq/dendrite.git
synced 2025-09-13 21:02:25 +03:00
More comments
This commit is contained in:
parent
2f11ed9fc1
commit
83a2c7d30f
1 changed files with 9 additions and 6 deletions
|
@ -39,8 +39,8 @@ type ServerACLs struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewServerACLs(db ServerACLDatabase) *ServerACLs {
|
func NewServerACLs(db ServerACLDatabase) *ServerACLs {
|
||||||
// Add some logging, as this can take a while.
|
// Add some logging, as this can take a while on larger instances.
|
||||||
logrus.Infof("Loading server ACLs")
|
logrus.Infof("Loading server ACLs...")
|
||||||
start := time.Now()
|
start := time.Now()
|
||||||
aclCount := 0
|
aclCount := 0
|
||||||
defer func() {
|
defer func() {
|
||||||
|
@ -62,13 +62,16 @@ func NewServerACLs(db ServerACLDatabase) *ServerACLs {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
logrus.WithError(err).Fatalf("Failed to get known rooms")
|
logrus.WithError(err).Fatalf("Failed to get known rooms")
|
||||||
}
|
}
|
||||||
// For each room, let's see if we have a server ACL state event. If we
|
|
||||||
// do then we'll process it into memory so that we have the regexes to
|
|
||||||
// hand.
|
|
||||||
|
|
||||||
|
// No rooms with ACLs, don't bother hitting the DB again.
|
||||||
|
if len(rooms) == 0 {
|
||||||
|
return acls
|
||||||
|
}
|
||||||
|
|
||||||
|
// Get ACLs for the required rooms, bail if we are unable to get them.
|
||||||
events, err := db.GetBulkStateACLs(ctx, rooms)
|
events, err := db.GetBulkStateACLs(ctx, rooms)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
logrus.WithError(err).Errorf("Failed to get server ACLs for all rooms: %q", err)
|
logrus.WithError(err).Fatal("Failed to get server ACLs for all rooms")
|
||||||
}
|
}
|
||||||
|
|
||||||
aclCount = len(events)
|
aclCount = len(events)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue