Skip to content

Commit

Permalink
use BucketContext & record utilization on removal
Browse files Browse the repository at this point in the history
  • Loading branch information
yusefnapora committed Jul 29, 2019
1 parent 9e2000b commit 487d482
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion table.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ var ErrPeerRejectedNoCapacity = errors.New("peer rejected; insufficient capacity

// RoutingTable defines the routing table.
type RoutingTable struct {

// ID of the local peer
local ID

Expand Down Expand Up @@ -155,7 +154,9 @@ func (rt *RoutingTable) RemoveCtx(ctx context.Context, p peer.ID) {

bucket := rt.Buckets[bucketID]
if bucket.Remove(p) {
ctx = metrics.BucketContext(ctx, rt.local, bucketID)
metrics.RecordPeerRemoved(ctx, bucketID)
metrics.RecordBucketUtilization(ctx, bucket.Len())
rt.PeerRemoved(p)
}
}
Expand Down

0 comments on commit 487d482

Please sign in to comment.