diff --git a/pkg/pool/pool.go b/pkg/pool/pool.go index 177389849..26e1ebe4f 100644 --- a/pkg/pool/pool.go +++ b/pkg/pool/pool.go @@ -71,16 +71,16 @@ func (p *Pool) Get(sz int) interface{} { } // Put adds a slice to the right bucket in the pool. -func (p *Pool) Put(s interface{}) error { +func (p *Pool) Put(s interface{}) { slice := reflect.ValueOf(s) - if slice.Kind() == reflect.Slice { - for i, size := range p.sizes { - if slice.Cap() > size { - continue - } - p.buckets[i].Put(slice.Slice(0, 0).Interface()) - return nil + + if slice.Kind() != reflect.Slice { + panic(fmt.Sprintf("%+v is not a slice", slice)) + } + for i, size := range p.sizes { + if slice.Cap() > size { + continue } + p.buckets[i].Put(slice.Slice(0, 0).Interface()) } - return fmt.Errorf("%+v is not a slice", slice) } diff --git a/scrape/scrape.go b/scrape/scrape.go index 69d7f5839..40f76532d 100644 --- a/scrape/scrape.go +++ b/scrape/scrape.go @@ -699,9 +699,7 @@ mainLoop: } } - if err := sl.buffers.Put(b); err != nil { - level.Error(sl.l).Log("msg", "buffer pool error", "err", err) - } + sl.buffers.Put(b) if scrapeErr == nil { scrapeErr = appErr