Minor memory improvement

This commit is contained in:
Till Faelligen 2024-02-22 18:39:37 +01:00
parent f3430bb21d
commit bed7dc70c0
No known key found for this signature in database
GPG key ID: 3DF82D8AB9211D4E

View file

@ -150,6 +150,11 @@ func (s *ServerACLs) OnServerACLUpdate(strippedEvent tables.StrippedEvent) {
"num_allowed": len(acls.allowedRegexes),
"num_denied": len(acls.deniedRegexes),
}).Debugf("Updating server ACLs for %q", strippedEvent.RoomID)
// Clear out Denied and Allowed, now that we have the compiled regexes.
// They are not needed anymore from this point on.
acls.Denied = nil
acls.Allowed = nil
s.aclsMutex.Lock()
defer s.aclsMutex.Unlock()
s.acls[strippedEvent.RoomID] = acls