From e4844ca819555f33912367aa659d6f4718668450 Mon Sep 17 00:00:00 2001 From: Hector Sanjuan Date: Tue, 8 May 2018 13:10:38 +0200 Subject: [PATCH] Monitor: address comments License: MIT Signed-off-by: Hector Sanjuan --- cluster.go | 8 ++++---- connect_graph.go | 2 +- ipfscluster.go | 4 ++-- monitor/basic/peer_monitor.go | 2 +- rpcutil/rpcutil.go | 4 ++-- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/cluster.go b/cluster.go index 6a5086a7..80a0f36e 100644 --- a/cluster.go +++ b/cluster.go @@ -558,7 +558,7 @@ func (c *Cluster) PeerAdd(addr ma.Multiaddr) (api.ID, error) { } ctxs, cancels := rpcutil.CtxsWithCancel(c.ctx, len(peers)) - defer rpcutil.Multicancel(cancels) + defer rpcutil.MultiCancel(cancels) errs := c.rpcClient.MultiCall( ctxs, @@ -1002,7 +1002,7 @@ func (c *Cluster) Peers() []api.ID { peers := make([]api.ID, len(members), len(members)) ctxs, cancels := rpcutil.CtxsWithCancel(c.ctx, len(members)) - defer rpcutil.Multicancel(cancels) + defer rpcutil.MultiCancel(cancels) errs := c.rpcClient.MultiCall( ctxs, @@ -1044,7 +1044,7 @@ func (c *Cluster) globalPinInfoCid(method string, h *cid.Cid) (api.GlobalPinInfo } ctxs, cancels := rpcutil.CtxsWithCancel(c.ctx, len(members)) - defer rpcutil.Multicancel(cancels) + defer rpcutil.MultiCancel(cancels) errs := c.rpcClient.MultiCall( ctxs, @@ -1105,7 +1105,7 @@ func (c *Cluster) globalPinInfoSlice(method string) ([]api.GlobalPinInfo, error) replies := make([][]api.PinInfoSerial, len(members), len(members)) ctxs, cancels := rpcutil.CtxsWithCancel(c.ctx, len(members)) - defer rpcutil.Multicancel(cancels) + defer rpcutil.MultiCancel(cancels) errs := c.rpcClient.MultiCall( ctxs, diff --git a/connect_graph.go b/connect_graph.go index a8918e11..3a7877dc 100644 --- a/connect_graph.go +++ b/connect_graph.go @@ -23,7 +23,7 @@ func (c *Cluster) ConnectGraph() (api.ConnectGraph, error) { peersSerials := make([][]api.IDSerial, len(members), len(members)) ctxs, cancels := rpcutil.CtxsWithCancel(c.ctx, len(members)) - defer rpcutil.Multicancel(cancels) + defer rpcutil.MultiCancel(cancels) errs := c.rpcClient.MultiCall( ctxs, diff --git a/ipfscluster.go b/ipfscluster.go index 21a00419..f5072f1f 100644 --- a/ipfscluster.go +++ b/ipfscluster.go @@ -152,12 +152,12 @@ type PinAllocator interface { Allocate(c *cid.Cid, current, candidates, priority map[peer.ID]api.Metric) ([]peer.ID, error) } -// PeerMonitor is a component in charge of publishing peers metrics and +// PeerMonitor is a component in charge of publishing a peer's metrics and // reading metrics from other peers in the cluster. The PinAllocator will // use the metrics provided by the monitor as candidates for Pin allocations. // // The PeerMonitor component also provides an Alert channel which is signaled -// when a metric is no longer received and the monitor judges identifies it +// when a metric is no longer received and the monitor identifies it // as a problem. type PeerMonitor interface { Component diff --git a/monitor/basic/peer_monitor.go b/monitor/basic/peer_monitor.go index a436f089..0b1bb36b 100644 --- a/monitor/basic/peer_monitor.go +++ b/monitor/basic/peer_monitor.go @@ -118,7 +118,7 @@ func (mon *Monitor) PublishMetric(m api.Metric) error { } ctxs, cancels := rpcutil.CtxsWithTimeout(mon.ctx, len(peers), m.GetTTL()/2) - defer rpcutil.Multicancel(cancels) + defer rpcutil.MultiCancel(cancels) logger.Debugf( "broadcasting metric %s to %s. Expires: %d", diff --git a/rpcutil/rpcutil.go b/rpcutil/rpcutil.go index dc3424f5..4731aabf 100644 --- a/rpcutil/rpcutil.go +++ b/rpcutil/rpcutil.go @@ -45,9 +45,9 @@ func CtxsWithCancel( return ctxs, cancels } -// Multicancel calls all the provided CancelFuncs. It +// MultiCancel calls all the provided CancelFuncs. It // is useful with "defer Multicancel()" -func Multicancel(cancels []context.CancelFunc) { +func MultiCancel(cancels []context.CancelFunc) { for _, cancel := range cancels { cancel() }