diff --git a/CHANGELOG.md b/CHANGELOG.md index 0ea15a81eb..72bc41ecc2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -20,7 +20,7 @@ We use *breaking :warning:* to mark changes that are not backward compatible (re - [#7224](https://github.com/thanos-io/thanos/pull/7224) Query-frontend: Add Redis username to the client configuration. - [#7220](https://github.com/thanos-io/thanos/pull/7220) Store Gateway: Fix lazy expanded postings caching partial expanded postings and bug of estimating remove postings with non existent value. Added `PromQLSmith` based fuzz test to improve correctness. - [#7244](https://github.com/thanos-io/thanos/pull/7244) Query: Fix Internal Server Error unknown targetHealth: "unknown" when trying to open the targets page. -- [#7248](https://github.com/thanos-io/thanos/pull/7248) Receive: Fix RemoteWriteAsync was sequentia lly executed causing high latency in the ingestion path. +- [#7248](https://github.com/thanos-io/thanos/pull/7248) Receive: Fix RemoteWriteAsync was sequentially executed causing high latency in the ingestion path. - [#7271](https://github.com/thanos-io/thanos/pull/7271) Query: fixing dedup iterator when working on mixed sample types. ### Added diff --git a/pkg/pool/worker_pool.go b/pkg/pool/worker_pool.go index b1e39bde78..6e3e77d7ab 100644 --- a/pkg/pool/worker_pool.go +++ b/pkg/pool/worker_pool.go @@ -28,26 +28,27 @@ type WorkerPool interface { type workerPool struct { sync.Once + ctx context.Context workCh chan Work cancel context.CancelFunc } func NewWorkerPool(workers uint) WorkerPool { + ctx, cancel := context.WithCancel(context.Background()) return &workerPool{ + ctx: ctx, + cancel: cancel, workCh: make(chan Work, workers), } } func (p *workerPool) Init() { p.Do(func() { - ctx, cancel := context.WithCancel(context.Background()) - p.cancel = cancel - for i := 0; i < p.Size(); i++ { go func() { for { select { - case <-ctx.Done(): + case <-p.ctx.Done(): // TODO: exhaust workCh before exit return case work := <-p.workCh: