accounting: don't show entries in both transferring and checking

See: https://forum.rclone.org/t/showing-progress-checking/12958
s3-about
Nick Craig-Wood 2019-11-19 13:22:33 +00:00
parent d46f8d0ae5
commit e0eeeaafcd
2 changed files with 13 additions and 4 deletions

View File

@ -332,10 +332,10 @@ Elapsed time: %10v
// Add per transfer stats if required
if !fs.Config.StatsOneLine {
if !s.checking.empty() {
_, _ = fmt.Fprintf(buf, "Checking:\n%s\n", s.checking.String(s.inProgress))
_, _ = fmt.Fprintf(buf, "Checking:\n%s\n", s.checking.String(s.inProgress, s.transferring))
}
if !s.transferring.empty() {
_, _ = fmt.Fprintf(buf, "Transferring:\n%s\n", s.transferring.String(s.inProgress))
_, _ = fmt.Fprintf(buf, "Transferring:\n%s\n", s.transferring.String(s.inProgress, nil))
}
}

View File

@ -63,12 +63,21 @@ func (ss *stringSet) count() int {
return len(ss.items)
}
// String returns string representation of set items.
func (ss *stringSet) String(progress *inProgress) string {
// String returns string representation of set items excluding any in
// exclude (if set).
func (ss *stringSet) String(progress *inProgress, exclude *stringSet) string {
ss.mu.RLock()
defer ss.mu.RUnlock()
strngs := make([]string, 0, len(ss.items))
for name := range ss.items {
if exclude != nil {
exclude.mu.RLock()
_, found := exclude.items[name]
exclude.mu.RUnlock()
if found {
continue
}
}
var out string
if acc := progress.get(name); acc != nil {
out = acc.String()