From 855a08810c0ff56c305898938f3e5ab3ec528fbd Mon Sep 17 00:00:00 2001 From: Michael Schurter Date: Tue, 2 Apr 2019 09:18:38 -0700 Subject: [PATCH] docker: improve stats names and comments --- drivers/docker/stats.go | 8 ++++---- drivers/docker/stats_test.go | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/docker/stats.go b/drivers/docker/stats.go index a04089978..f02bd1492 100644 --- a/drivers/docker/stats.go +++ b/drivers/docker/stats.go @@ -32,9 +32,9 @@ type usageSender struct { mu sync.Mutex } -// newDestChPair returns a destCh that supports concurrent sending and closing, -// and the receiver end of the chan. -func newDestChPair() (*usageSender, <-chan *structs.TaskResourceUsage) { +// newStatsChanPipe returns a chan wrapped in a struct that supports concurrent +// sending and closing, and the receiver end of the chan. +func newStatsChanPipe() (*usageSender, <-chan *structs.TaskResourceUsage) { destCh := make(chan *cstructs.TaskResourceUsage, 1) return &usageSender{ destCh: destCh, @@ -82,7 +82,7 @@ func (h *taskHandle) Stats(ctx context.Context, interval time.Duration) (<-chan default: } - destCh, recvCh := newDestChPair() + destCh, recvCh := newStatsChanPipe() go h.collectStats(ctx, destCh, interval) return recvCh, nil } diff --git a/drivers/docker/stats_test.go b/drivers/docker/stats_test.go index e1ed3ba62..f9c290c3c 100644 --- a/drivers/docker/stats_test.go +++ b/drivers/docker/stats_test.go @@ -17,7 +17,7 @@ func TestDriver_DockerStatsCollector(t *testing.T) { require := require.New(t) src := make(chan *docker.Stats) defer close(src) - dst, recvCh := newDestChPair() + dst, recvCh := newStatsChanPipe() defer dst.close() stats := &docker.Stats{} stats.CPUStats.ThrottlingData.Periods = 10 @@ -72,7 +72,7 @@ func TestDriver_DockerUsageSender(t *testing.T) { // sample payload res := &cstructs.TaskResourceUsage{} - destCh, recvCh := newDestChPair() + destCh, recvCh := newStatsChanPipe() // Sending should never fail destCh.send(res)