mirror of
https://github.com/netbirdio/netbird.git
synced 2026-10-24 14:29:07 +02:00
minor change
This commit is contained in:
@@ -1,6 +1,8 @@
|
|||||||
package server
|
package server
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"context"
|
||||||
|
|
||||||
"github.com/netbirdio/netbird/management/server/types"
|
"github.com/netbirdio/netbird/management/server/types"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -22,6 +24,19 @@ func (am *DefaultAccountManager) getAccountFromHolder(accountID string) *types.A
|
|||||||
return am.holder.GetAccount(accountID)
|
return am.holder.GetAccount(accountID)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (am *DefaultAccountManager) getAccountFromHolderOrInit(accountID string) *types.Account {
|
||||||
|
a := am.holder.GetAccount(accountID)
|
||||||
|
if a != nil {
|
||||||
|
return a
|
||||||
|
}
|
||||||
|
account, err := am.requestBuffer.GetAccountWithBackpressure(context.Background(), accountID)
|
||||||
|
if err != nil {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
am.holder.AddAccount(account)
|
||||||
|
return account
|
||||||
|
}
|
||||||
|
|
||||||
func (am *DefaultAccountManager) updateAccountInHolder(account *types.Account) {
|
func (am *DefaultAccountManager) updateAccountInHolder(account *types.Account) {
|
||||||
am.holder.AddAccount(account)
|
am.holder.AddAccount(account)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1221,7 +1221,7 @@ func (am *DefaultAccountManager) UpdateAccountPeers(ctx context.Context, account
|
|||||||
err error
|
err error
|
||||||
)
|
)
|
||||||
if am.experimentalNetworkMap(accountID) {
|
if am.experimentalNetworkMap(accountID) {
|
||||||
account = am.getAccountFromHolder(accountID)
|
account = am.getAccountFromHolderOrInit(accountID)
|
||||||
} else {
|
} else {
|
||||||
account, err = am.requestBuffer.GetAccountWithBackpressure(ctx, accountID)
|
account, err = am.requestBuffer.GetAccountWithBackpressure(ctx, accountID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|||||||
Reference in New Issue
Block a user