From 412bf9b8c73e2cc1a3d57bce3ec8f0bf0e411b5c Mon Sep 17 00:00:00 2001 From: Newnius Date: Mon, 6 May 2019 15:36:31 +0800 Subject: [PATCH] bugfix --- Dockerfile.dev | 12 ------------ src/resource_pool.go | 3 ++- 2 files changed, 2 insertions(+), 13 deletions(-) delete mode 100644 Dockerfile.dev diff --git a/Dockerfile.dev b/Dockerfile.dev deleted file mode 100644 index 58884e9..0000000 --- a/Dockerfile.dev +++ /dev/null @@ -1,12 +0,0 @@ -FROM ubuntu:16.04 - -RUN apt update && \ - apt install -y wget vim git gcc httpie dnsutils - -RUN wget https://dl.google.com/go/go1.12.4.linux-amd64.tar.gz && \ - tar -C /usr/local -xzf go1.12.4.linux-amd64.tar.gz && \ - rm go1.12.4.linux-amd64.tar.gz - -ENV PATH $PATH:/usr/local/go/bin - -RUN go get github.com/Shopify/sarama \ No newline at end of file diff --git a/src/resource_pool.go b/src/resource_pool.go index dccb8eb..f1181af 100644 --- a/src/resource_pool.go +++ b/src/resource_pool.go @@ -15,6 +15,7 @@ type ResourcePool struct { func (pool *ResourcePool) start() { go func() { /* waiting for data */ + pool.history = []PoolStatus{} time.Sleep(time.Second * 30) for { summary := PoolStatus{} @@ -58,7 +59,7 @@ func (pool *ResourcePool) start() { pool.history = append(pool.history, summary) if len(pool.history) > 60 { - pool.history = pool.history[0:60] + pool.history = pool.history[len(pool.history)-60:] } time.Sleep(time.Second * 60) }