trees: show its phases as N of M, with progress, elapsed time and ETA (closes #113)
check / check (push) Canceled after 0s
check / check (push) Canceled after 0s
trees now runs in four phases, open, read, group and write, each under the progress display scan uses, until the summary line. open covers a wait on a busy database. read counts the records and reads them in one read-only transaction, so the two agree during a scan; group counts the directories, and write the groups. The rows reach stdout through a writer. When stdout and stderr are the same file, it clears the display and holds its lock while writing, so no row shares a line with the display on a shared terminal; otherwise it writes without the lock, so a slow reader of stdout cannot stop the display. Each rate names what its phase counts. Judgement call: opening the database is a phase of its own, so there are four phases, not the three the issue sketches. Model: opus-5-5
This commit was merged in pull request #121.
This commit is contained in:
+3
-3
@@ -1478,7 +1478,7 @@ func dbRecords(t *testing.T, db *sql.DB) []scanRec {
|
||||
|
||||
var recs []scanRec
|
||||
|
||||
err := loadFileRows(t.Context(), db, func(r scanRec) {
|
||||
err := loadFileRows(t.Context(), db, func(int64) {}, func(r scanRec) {
|
||||
recs = append(recs, r)
|
||||
})
|
||||
if err != nil {
|
||||
@@ -1550,7 +1550,7 @@ func assertSmokeTreeGroups(t *testing.T, dir string, db *sql.DB) {
|
||||
|
||||
super, dirs := dbTree(t, db)
|
||||
|
||||
tg := collectTreeGroups(dirs, super)
|
||||
tg := collectTreeGroups(dirs, super, nil)
|
||||
if len(tg) != 1 {
|
||||
t.Fatalf("len(tree groups) = %d, want 1", len(tg))
|
||||
}
|
||||
@@ -2092,7 +2092,7 @@ func TestTreesUnhashedNeverEqual(t *testing.T) {
|
||||
for name, unknown := range cases {
|
||||
super, dirs := treeOf(t, append(slices.Clone(shared), unknown...))
|
||||
|
||||
if tg := collectTreeGroups(dirs, super); len(tg) != 0 {
|
||||
if tg := collectTreeGroups(dirs, super, nil); len(tg) != 0 {
|
||||
t.Errorf("%s: tree groups = %d, want 0 (the files may differ)",
|
||||
name, len(tg))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user