Add 1 microsecond delay to each call to walkPath() to fix incorrect filesMatched stat
This commit is contained in:
parent
60ec29612b
commit
646c962e5d
13
cmd/files.go
13
cmd/files.go
|
@ -248,7 +248,7 @@ func walkPath(path string, fileChannel chan<- string, stats *scanStats, limit ch
|
||||||
}()
|
}()
|
||||||
|
|
||||||
errorChannel := make(chan error)
|
errorChannel := make(chan error)
|
||||||
done := make(chan bool, 1)
|
done := make(chan bool)
|
||||||
|
|
||||||
nodes, err := os.ReadDir(path)
|
nodes, err := os.ReadDir(path)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -328,7 +328,9 @@ func walkPath(path string, fileChannel chan<- string, stats *scanStats, limit ch
|
||||||
go func() {
|
go func() {
|
||||||
wg.Wait()
|
wg.Wait()
|
||||||
|
|
||||||
done <- true
|
time.Sleep(1 * time.Microsecond)
|
||||||
|
|
||||||
|
close(done)
|
||||||
}()
|
}()
|
||||||
|
|
||||||
Poll:
|
Poll:
|
||||||
|
@ -443,11 +445,6 @@ func scanPaths(paths []string, sort string, index *fileIndex, formats types.Type
|
||||||
go func() {
|
go func() {
|
||||||
wg.Wait()
|
wg.Wait()
|
||||||
|
|
||||||
// Without this delay, occasionally a single file is missed when indexing,
|
|
||||||
// presumably due to a timing issue with closing the done channel.
|
|
||||||
// Pending a proper fix.
|
|
||||||
time.Sleep((100 * time.Millisecond))
|
|
||||||
|
|
||||||
close(done)
|
close(done)
|
||||||
}()
|
}()
|
||||||
|
|
||||||
|
@ -468,7 +465,7 @@ Poll:
|
||||||
filesMatched+filesSkipped,
|
filesMatched+filesSkipped,
|
||||||
directoriesMatched,
|
directoriesMatched,
|
||||||
directoriesMatched+directoriesSkipped,
|
directoriesMatched+directoriesSkipped,
|
||||||
time.Since(startTime)-100*time.Millisecond,
|
time.Since(startTime),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -14,7 +14,7 @@ import (
|
||||||
|
|
||||||
const (
|
const (
|
||||||
AllowedCharacters string = `^[A-z0-9.\-_]+$`
|
AllowedCharacters string = `^[A-z0-9.\-_]+$`
|
||||||
ReleaseVersion string = "3.9.0"
|
ReleaseVersion string = "3.9.1"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
|
Loading…
Reference in New Issue