Skip to content

Commit

Permalink
worker numbering
Browse files Browse the repository at this point in the history
  • Loading branch information
gammazero committed Mar 20, 2024
1 parent 0e1e887 commit 60a098a
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion internal/ingest/ingest.go
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,7 @@ type Ingester struct {
// Context and cancel function used to cancel all workers.
cancelWorkers context.CancelFunc
workersCtx context.Context
nextWorkerNum int

// Worker pool resizing.
stopWorker chan struct{}
Expand Down Expand Up @@ -868,8 +869,9 @@ func (ing *Ingester) RunWorkers(n int) {
for n > ing.workerPoolSize {
// Start worker.
ing.waitForWorkers.Add(1)
go ing.ingestWorker(ing.workersCtx, ing.syncFinishedEvents, ing.workerPoolSize)
go ing.ingestWorker(ing.workersCtx, ing.syncFinishedEvents, ing.nextWorkerNum)
ing.workerPoolSize++
ing.nextWorkerNum++
}
for n < ing.workerPoolSize {
// Stop worker.
Expand Down

0 comments on commit 60a098a

Please sign in to comment.