Skip to content

Commit

Permalink
fix: fix update network metrics not updated
Browse files Browse the repository at this point in the history
Signed-off-by: Sacha Froment <sfroment42@gmail.com>
  • Loading branch information
sfroment committed Feb 1, 2019
1 parent 3f05b5f commit f01552c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
2 changes: 2 additions & 0 deletions core/manager/account/p2p.go
Expand Up @@ -156,5 +156,7 @@ func (a *Account) UpdateP2PNetwork(ctx context.Context, opts *P2PNetworkOptions)
return err
}

a.node.UseNetworkMetrics(ctx, a.metrics)

return a.node.UseNetworkDriver(ctx, a.network)
}
8 changes: 8 additions & 0 deletions core/node/network.go
Expand Up @@ -21,6 +21,14 @@ func WithNetworkMetrics(metrics network.Metrics) NewNodeOption {
}
}

func (n *Node) UseNetworkMetrics(ctx context.Context, metrics network.Metrics) {
tracer := tracing.EnterFunc(ctx, metrics)
defer tracer.Finish()
ctx = tracer.Context()

n.networkMetrics = metrics
}

func (n *Node) UseNetworkDriver(ctx context.Context, driver network.Driver) error {
tracer := tracing.EnterFunc(ctx, driver)
defer tracer.Finish()
Expand Down

0 comments on commit f01552c

Please sign in to comment.