Compare commits
1
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c5aa5fdbfc |
@@ -410,8 +410,8 @@ func userVersion(ctx context.Context, db *sql.DB) (int, error) {
|
||||
func loadFileRows(ctx context.Context, db *sql.DB, total func(n int64),
|
||||
fn func(r scanRec),
|
||||
) error {
|
||||
// Everything goes through tx: db has one connection, so a query on
|
||||
// db would wait for tx forever.
|
||||
// Everything goes through tx: the report connection is the only
|
||||
// one, so a query on db would wait for tx forever.
|
||||
tx, err := db.BeginTx(ctx, &sql.TxOptions{ReadOnly: true})
|
||||
if err != nil {
|
||||
return fmt.Errorf("read records: %w", err)
|
||||
|
||||
+1
-1
@@ -297,7 +297,7 @@ func (p *progress) warnf(format string, args ...any) {
|
||||
// "sfdupes trees". It holds what is written to it and writes that to
|
||||
// out in pieces of about ioBufSize bytes, each under the display's
|
||||
// lock with the display cleared first, as warnf does for a warning: no
|
||||
// draw lands in the middle of a piece, and the next draw shows the
|
||||
// draw lands in the middle of a piece, and the next one shows the
|
||||
// display again, on the line below. Every write to it must end with a
|
||||
// newline, as a row written with one fmt.Fprintf does, so that each
|
||||
// piece ends a line. Flush writes what it holds once the last row is
|
||||
|
||||
+3
-8
@@ -5,6 +5,7 @@ import (
|
||||
"math"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"slices"
|
||||
"strings"
|
||||
"testing"
|
||||
"time"
|
||||
@@ -612,14 +613,8 @@ func TestProgressWriterRowsOnOwnLines(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
if len(shown) != len(want) {
|
||||
t.Fatalf("terminal shows %d rows, want %d", len(shown), len(want))
|
||||
}
|
||||
|
||||
for i := range want {
|
||||
if shown[i] != want[i] {
|
||||
t.Fatalf("terminal shows %q, want %q", shown[i], want[i])
|
||||
}
|
||||
if !slices.Equal(shown, want) {
|
||||
t.Errorf("terminal shows rows %q, want %q", shown, want)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user