mirror of
https://github.com/netbirdio/netbird.git
synced 2025-06-21 10:18:50 +02:00
Improve Management startup time (#355)
This commit is contained in:
parent
b96e616844
commit
dab146ed87
@ -165,16 +165,18 @@ func BuildManager(
|
|||||||
ctx: context.Background(),
|
ctx: context.Background(),
|
||||||
}
|
}
|
||||||
|
|
||||||
// if account has not default account
|
// if account has not default group
|
||||||
// we build 'all' group and add all peers into it
|
// we create 'all' group and add all peers into it
|
||||||
// also we create default rule with source an destination
|
// also we create default rule with source as destination
|
||||||
// groups 'all'
|
|
||||||
for _, account := range store.GetAllAccounts() {
|
for _, account := range store.GetAllAccounts() {
|
||||||
|
_, err := account.GetGroupAll()
|
||||||
|
if err != nil {
|
||||||
am.addAllGroup(account)
|
am.addAllGroup(account)
|
||||||
if err := store.SaveAccount(account); err != nil {
|
if err := store.SaveAccount(account); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
gocacheClient := gocache.New(CacheExpirationMax, 30*time.Minute)
|
gocacheClient := gocache.New(CacheExpirationMax, 30*time.Minute)
|
||||||
gocacheStore := cacheStore.NewGoCache(gocacheClient, nil)
|
gocacheStore := cacheStore.NewGoCache(gocacheClient, nil)
|
||||||
@ -640,7 +642,7 @@ func (am *DefaultAccountManager) createAccount(accountId, userId, domain string)
|
|||||||
return account, nil
|
return account, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// addAllGroup to account object it it doesn't exists
|
// addAllGroup to account object if it doesn't exists
|
||||||
func (am *DefaultAccountManager) addAllGroup(account *Account) {
|
func (am *DefaultAccountManager) addAllGroup(account *Account) {
|
||||||
if len(account.Groups) == 0 {
|
if len(account.Groups) == 0 {
|
||||||
allGroup := &Group{
|
allGroup := &Group{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user