From 933ab8a34e0f27ec67012f3ca2e116a1509ffe56 Mon Sep 17 00:00:00 2001 From: Krasi Georgiev Date: Tue, 20 Feb 2018 13:32:23 +0200 Subject: [PATCH] stupid return mistake fix, and dropped the additional assertion check! --- pkg/pool/pool.go | 1 + scrape/scrape.go | 7 ++----- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/pkg/pool/pool.go b/pkg/pool/pool.go index e68367e0b..2ee897185 100644 --- a/pkg/pool/pool.go +++ b/pkg/pool/pool.go @@ -82,5 +82,6 @@ func (p *Pool) Put(s interface{}) { continue } p.buckets[i].Put(slice.Slice(0, 0).Interface()) + return } } diff --git a/scrape/scrape.go b/scrape/scrape.go index 40f76532d..0b6e38bb0 100644 --- a/scrape/scrape.go +++ b/scrape/scrape.go @@ -662,11 +662,8 @@ mainLoop: time.Since(last).Seconds(), ) } - b, ok := sl.buffers.Get(sl.lastScrapeSize).([]byte) - if !ok { - b = make([]byte, 0, sl.lastScrapeSize) - level.Error(sl.l).Log("msg", "buffer pool type assertion error") - } + + b := sl.buffers.Get(sl.lastScrapeSize).([]byte) buf := bytes.NewBuffer(b) scrapeErr := sl.scraper.scrape(scrapeCtx, buf)