fix: 修复 file.ReadLineWithParallel 函数由于错误的读取数量导致重复读和效率低下的问题
This commit is contained in:
parent
342d3cd75f
commit
f19e7ccefa
|
@ -2,6 +2,7 @@ package file
|
|||
|
||||
import (
|
||||
"bufio"
|
||||
"fmt"
|
||||
"github.com/kercylan98/minotaur/utils/slice"
|
||||
"io"
|
||||
"os"
|
||||
|
@ -186,7 +187,8 @@ func ReadLineWithParallel(filename string, chunkSize int64, handlerFunc func(str
|
|||
end = e + 1
|
||||
}
|
||||
endMutex.Unlock()
|
||||
r := io.NewSectionReader(file, chunk[0], e)
|
||||
r := io.NewSectionReader(file, chunk[0], e-chunk[0])
|
||||
fmt.Println(chunk[0], e)
|
||||
|
||||
scanner := bufio.NewScanner(r)
|
||||
for scanner.Scan() {
|
||||
|
|
Loading…
Reference in New Issue