mirror of
https://github.com/octoleo/syncthing.git
synced 2025-01-05 08:02:13 +00:00
lib/scanner: Remove unused field, move WaitGroup.Add out of loop (#7323)
This commit is contained in:
parent
1522cf74bc
commit
42917d707d
@ -63,7 +63,6 @@ func HashFile(ctx context.Context, fs fs.Filesystem, path string, blockSize int,
|
|||||||
// is closed and all items handled.
|
// is closed and all items handled.
|
||||||
type parallelHasher struct {
|
type parallelHasher struct {
|
||||||
fs fs.Filesystem
|
fs fs.Filesystem
|
||||||
workers int
|
|
||||||
outbox chan<- ScanResult
|
outbox chan<- ScanResult
|
||||||
inbox <-chan protocol.FileInfo
|
inbox <-chan protocol.FileInfo
|
||||||
counter Counter
|
counter Counter
|
||||||
@ -74,7 +73,6 @@ type parallelHasher struct {
|
|||||||
func newParallelHasher(ctx context.Context, fs fs.Filesystem, workers int, outbox chan<- ScanResult, inbox <-chan protocol.FileInfo, counter Counter, done chan<- struct{}) {
|
func newParallelHasher(ctx context.Context, fs fs.Filesystem, workers int, outbox chan<- ScanResult, inbox <-chan protocol.FileInfo, counter Counter, done chan<- struct{}) {
|
||||||
ph := ¶llelHasher{
|
ph := ¶llelHasher{
|
||||||
fs: fs,
|
fs: fs,
|
||||||
workers: workers,
|
|
||||||
outbox: outbox,
|
outbox: outbox,
|
||||||
inbox: inbox,
|
inbox: inbox,
|
||||||
counter: counter,
|
counter: counter,
|
||||||
@ -82,8 +80,8 @@ func newParallelHasher(ctx context.Context, fs fs.Filesystem, workers int, outbo
|
|||||||
wg: sync.NewWaitGroup(),
|
wg: sync.NewWaitGroup(),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ph.wg.Add(workers)
|
||||||
for i := 0; i < workers; i++ {
|
for i := 0; i < workers; i++ {
|
||||||
ph.wg.Add(1)
|
|
||||||
go ph.hashFiles(ctx)
|
go ph.hashFiles(ctx)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user