stupid return mistake fix, and dropped the additional assertion check!

This commit is contained in:
Krasi Georgiev 2018-02-20 13:32:23 +02:00
parent 9b7f0cfa88
commit 933ab8a34e
2 changed files with 3 additions and 5 deletions

View file

@ -82,5 +82,6 @@ func (p *Pool) Put(s interface{}) {
continue continue
} }
p.buckets[i].Put(slice.Slice(0, 0).Interface()) p.buckets[i].Put(slice.Slice(0, 0).Interface())
return
} }
} }

View file

@ -662,11 +662,8 @@ mainLoop:
time.Since(last).Seconds(), time.Since(last).Seconds(),
) )
} }
b, ok := sl.buffers.Get(sl.lastScrapeSize).([]byte)
if !ok { b := sl.buffers.Get(sl.lastScrapeSize).([]byte)
b = make([]byte, 0, sl.lastScrapeSize)
level.Error(sl.l).Log("msg", "buffer pool type assertion error")
}
buf := bytes.NewBuffer(b) buf := bytes.NewBuffer(b)
scrapeErr := sl.scraper.scrape(scrapeCtx, buf) scrapeErr := sl.scraper.scrape(scrapeCtx, buf)