Skip to content

Commit 4777dfb

Browse files
committed
Fix bug: deadlock when files are under 5 lines due to regression
1 parent 31aa6c0 commit 4777dfb

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

files/file.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ func filterColumnsAsync(bytes []byte, targetCols []string, csvDelimiter string)
5757

5858
jobchan := make(chan string, len(lines))
5959
resultschan := make(chan string, len(lines))
60-
for id := 0; id < int(math.Round(float64(len(lines)) * 0.10)); id++ {
60+
for id := 0; id < int(math.Round(float64(len(lines)) * 0.5)); id++ {
6161
go Line.ProcessLineWorker(id, jobchan, resultschan, indexCols, csvDelimiter)
6262
}
6363

@@ -71,6 +71,7 @@ func filterColumnsAsync(bytes []byte, targetCols []string, csvDelimiter string)
7171
for i := 0; i < len(lines); i++ {
7272
ls = append(ls, <-resultschan)
7373
}
74+
close(resultschan)
7475
return strings.Join(ls, "\n")
7576
}
7677

0 commit comments

Comments
 (0)