This commit is contained in:
@@ -520,6 +520,11 @@ func (f *folder) scanSubdirs(subDirs []string) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if err := batch.flushIfFull(); err != nil {
|
if err := batch.flushIfFull(); err != nil {
|
||||||
|
// Prevent a race between the scan aborting due to context
|
||||||
|
// cancellation and releasing the snapshot in defer here.
|
||||||
|
scanCancel()
|
||||||
|
for range fchan {
|
||||||
|
}
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -136,6 +136,10 @@ func (ph *parallelHasher) hashFiles(ctx context.Context) {
|
|||||||
|
|
||||||
func (ph *parallelHasher) closeWhenDone() {
|
func (ph *parallelHasher) closeWhenDone() {
|
||||||
ph.wg.Wait()
|
ph.wg.Wait()
|
||||||
|
// In case the hasher aborted on context, wait for filesystem
|
||||||
|
// walking/progress routine to finish.
|
||||||
|
for range ph.inbox {
|
||||||
|
}
|
||||||
if ph.done != nil {
|
if ph.done != nil {
|
||||||
close(ph.done)
|
close(ph.done)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user