diff --git a/logic/acls.go b/logic/acls.go index 6a99fb36c..4cc887833 100644 --- a/logic/acls.go +++ b/logic/acls.go @@ -18,11 +18,6 @@ var ( aclCacheMap = make(map[string]models.Acl) ) -func init() { - // load acls into cache - _ = listAcls() -} - // CreateDefaultAclNetworkPolicies - create default acl network policies func CreateDefaultAclNetworkPolicies(netID models.NetworkID) { if netID.String() == "" { @@ -177,6 +172,9 @@ func InsertAcl(a models.Acl) error { func GetAcl(aID string) (models.Acl, error) { a := models.Acl{} if servercfg.CacheEnabled() { + if len(aclCacheMap) == 0 { + _ = listAcls() + } var ok bool a, ok = getAclFromCache(aID) if ok {