Improve disk UI and build performance

This commit is contained in:
2026-04-23 22:51:36 +03:00
parent 31bac2b5d8
commit e7917b41b5
15 changed files with 651 additions and 154 deletions

View File

@@ -2,6 +2,7 @@ package watcher
import (
"context"
"os"
"path/filepath"
"sort"
"sync"
@@ -121,22 +122,17 @@ func (w *Watcher) probe() {
}
func discoverDisks(root string) map[string]disk.DiskInfo {
candidates := []string{root}
if entries, err := filepath.Glob(filepath.Join(root, "*")); err == nil {
for _, path := range entries {
candidates = append(candidates, path)
}
entries, err := os.ReadDir(root)
if err != nil {
return map[string]disk.DiskInfo{}
}
disks := make(map[string]disk.DiskInfo)
seen := make(map[string]struct{}, len(candidates))
for _, mountPath := range candidates {
if _, ok := seen[mountPath]; ok {
for _, entry := range entries {
if !entry.IsDir() {
continue
}
seen[mountPath] = struct{}{}
mountPath := filepath.Join(root, entry.Name())
info, _ := disk.Probe(mountPath)
if info.State == disk.DiskAbsent {
continue