mirror of
https://github.com/netbirdio/management-refactor.git
synced 2026-05-22 17:12:59 -07:00
fix calculate network map
This commit is contained in:
@@ -28,7 +28,7 @@ func NewController(store *db.Store, metrics *appmetrics.AppMetrics, updateChanne
|
||||
}
|
||||
}
|
||||
|
||||
func (c *Controller) CalculateNetworkMap(accountID string) (*network_map.NetworkMap, error) {
|
||||
func (c *Controller) CalculateNetworkMap(ctx context.Context, accountID string) (*network_map.NetworkMap, error) {
|
||||
_, err := c.repo.GetNetworkMapData(accountID)
|
||||
if err != nil {
|
||||
// usually return error
|
||||
@@ -36,13 +36,13 @@ func (c *Controller) CalculateNetworkMap(accountID string) (*network_map.Network
|
||||
|
||||
// Do calc on data
|
||||
|
||||
log.Tracef("Calculating network map for account on public")
|
||||
log.WithContext(ctx).Tracef("Calculating network map for account on public")
|
||||
|
||||
return &network_map.NetworkMap{}, nil
|
||||
}
|
||||
|
||||
func (c *Controller) UpdatePeers(ctx context.Context, accountID string) error {
|
||||
_, err := c.CalculateNetworkMap(accountID)
|
||||
_, err := c.CalculateNetworkMap(ctx, accountID)
|
||||
if err != nil {
|
||||
log.Errorf("Failed to calculate network map for account %s: %v", accountID, err)
|
||||
return err
|
||||
|
||||
@@ -5,12 +5,13 @@
|
||||
package manager
|
||||
|
||||
import (
|
||||
context "context"
|
||||
reflect "reflect"
|
||||
"context"
|
||||
"reflect"
|
||||
|
||||
gomock "github.com/golang/mock/gomock"
|
||||
templates "github.com/netbirdio/management-refactor/internals/modules/templates"
|
||||
db "github.com/netbirdio/management-refactor/internals/shared/db"
|
||||
"github.com/golang/mock/gomock"
|
||||
|
||||
"github.com/netbirdio/management-refactor/internals/modules/templates"
|
||||
"github.com/netbirdio/management-refactor/internals/shared/db"
|
||||
)
|
||||
|
||||
// MockRepository is a mock of Repository interface.
|
||||
|
||||
Reference in New Issue
Block a user