From ece014ddfe2b4e56ec9a2f9e03210ca4e69bf421 Mon Sep 17 00:00:00 2001
From: Till Faelligen <2353100+S7evinK@users.noreply.github.com>
Date: Thu, 19 Dec 2024 19:42:45 +0100
Subject: [PATCH] Add some more logging

---
 roomserver/acls/acls.go | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/roomserver/acls/acls.go b/roomserver/acls/acls.go
index 201f36df..4d59c879 100644
--- a/roomserver/acls/acls.go
+++ b/roomserver/acls/acls.go
@@ -14,6 +14,7 @@ import (
 	"regexp"
 	"strings"
 	"sync"
+	"time"
 
 	"github.com/element-hq/dendrite/roomserver/storage/tables"
 	"github.com/matrix-org/gomatrixserverlib"
@@ -40,6 +41,16 @@ type ServerACLs struct {
 }
 
 func NewServerACLs(db ServerACLDatabase) *ServerACLs {
+	// Add some logging, as this can take a while.
+	logrus.Infof("Loading server ACLs")
+	start := time.Now()
+	aclCount := 0
+	defer func() {
+		logrus.WithFields(logrus.Fields{
+			"duration": time.Since(start),
+			"acls":     aclCount,
+		}).Info("Finished loading server ACLs")
+	}()
 	ctx := context.TODO()
 	acls := &ServerACLs{
 		acls: make(map[string]*serverACL),
@@ -62,6 +73,8 @@ func NewServerACLs(db ServerACLDatabase) *ServerACLs {
 		logrus.WithError(err).Errorf("Failed to get server ACLs for all rooms: %q", err)
 	}
 
+	aclCount = len(events)
+
 	for _, event := range events {
 		acls.OnServerACLUpdate(event)
 	}