diff --git a/db/iterator.go b/db/iterator.go index 9da6ce5d..9d576862 100644 --- a/db/iterator.go +++ b/db/iterator.go @@ -232,18 +232,9 @@ func (i *iterator) checkState(ctx context.Context) bool { func (i *iterator) setupWorkers(ctx context.Context) { - count := ints.Between(1, maxWorkers, workerCount) - if i.checkState(ctx) { - switch { - case i.tasks == 0: - for w := 1; w <= count; w++ { - go i.setupWorker(ctx, i.jobs, i.vals) - } - default: - for w := 1; w <= ints.Between(1, count, i.tasks); w++ { - go i.setupWorker(ctx, i.jobs, i.vals) - } + for w := 1; w <= ints.Between(1, workerCount, i.tasks); w++ { + go i.setupWorker(ctx, i.jobs, i.vals) } } diff --git a/db/vars.go b/db/vars.go index ed3219f2..25b29ea9 100644 --- a/db/vars.go +++ b/db/vars.go @@ -74,10 +74,6 @@ const ( ) var ( - // maxWorkers enables limiting the maximum number of - // workers to start, regardless of the CPU count. - maxWorkers = 20 - // workerCount specifies how many workers should be used // to process each query statement concurrently. workerCount = runtime.NumCPU() * 2