SQL statements now run in serial mode by default

This commit is contained in:
Tobie Morgan Hitchcock 2018-08-10 19:16:42 +01:00
parent e57e90a2f5
commit c7ae796275
2 changed files with 2 additions and 15 deletions

View file

@ -232,18 +232,9 @@ func (i *iterator) checkState(ctx context.Context) bool {
func (i *iterator) setupWorkers(ctx context.Context) { func (i *iterator) setupWorkers(ctx context.Context) {
count := ints.Between(1, maxWorkers, workerCount)
if i.checkState(ctx) { if i.checkState(ctx) {
switch { for w := 1; w <= ints.Between(1, workerCount, i.tasks); w++ {
case i.tasks == 0: go i.setupWorker(ctx, i.jobs, i.vals)
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)
}
} }
} }

View file

@ -74,10 +74,6 @@ const (
) )
var ( 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 // workerCount specifies how many workers should be used
// to process each query statement concurrently. // to process each query statement concurrently.
workerCount = runtime.NumCPU() * 2 workerCount = runtime.NumCPU() * 2