Show progress while loading the record index
On a database with tens of millions of records, indexing the existing rows before the walk takes real single-core time with no output, which is indistinguishable from a hang. Give the load its own spinner, and render every phase display the moment the phase starts instead of waiting for its first completed item.
This commit is contained in:
7
scan.go
7
scan.go
@@ -186,10 +186,17 @@ func syncScan(db *sql.DB, roots []string, workers int,
|
||||
// can be recognized as a possible duplicate of a tree scanned
|
||||
// separately into the same database.
|
||||
func (s *scanState) loadIndex(roots []string) error {
|
||||
// Indexing tens of millions of records takes real time; without a
|
||||
// display the scan looks hung before the walk begins.
|
||||
prog := newProgress("load", -1)
|
||||
defer prog.finish()
|
||||
|
||||
s.existing = make(map[string]fileMeta)
|
||||
|
||||
return loadFileMeta(s.db,
|
||||
func(path string, size, mtime int64, hashed bool) {
|
||||
prog.increment()
|
||||
|
||||
if underAnyRoot(path, roots) {
|
||||
s.existing[path] = fileMeta{
|
||||
size: size, mtime: mtime, hashed: hashed,
|
||||
|
||||
Reference in New Issue
Block a user