Skip to content

Commit

Permalink
Fix bug: deadlock when files are under 5 lines due to regression
Browse files Browse the repository at this point in the history
  • Loading branch information
zeddo123 committed Aug 31, 2023
1 parent 31aa6c0 commit 4777dfb
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion files/file.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ func filterColumnsAsync(bytes []byte, targetCols []string, csvDelimiter string)

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

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

Expand Down

0 comments on commit 4777dfb

Please sign in to comment.