Skip to content

Commit 5cd581b

Browse files
authored
disable concurrency when the format is not CSV (#15)
1 parent 9529a99 commit 5cd581b

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

main.go

+9
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ var (
7070
maxBytesPerTask int
7171
debug bool
7272
workers int
73+
enableConcurrency bool
7374
diskThroughput int
7475
streamLoadThroughput int
7576
checkUTF8 bool
@@ -245,6 +246,9 @@ func paramCheck() {
245246
continue
246247
}
247248
kv := strings.Split(v, ":")
249+
if strings.ToLower(kv[0]) == "format" && strings.ToLower(kv[1]) == "csv" {
250+
enableConcurrency = true
251+
}
248252
if len(kv) > 2 {
249253
headers[kv[0]] = strings.Join(kv[1:], ":")
250254
} else {
@@ -294,6 +298,11 @@ func calculateAndCheckWorkers(reader *file.FileReader, size int64) {
294298
return
295299
}
296300

301+
if !enableConcurrency {
302+
loadInfo.Workers = 1
303+
return
304+
}
305+
297306
ratio := float64(size) / float64(maxBytesPerTask)
298307
tmpWorkers := 0
299308

0 commit comments

Comments
 (0)