forked from TrueCloudLab/rclone
accounting: don't show entries in both transferring and checking
See: https://forum.rclone.org/t/showing-progress-checking/12958
This commit is contained in:
parent
d46f8d0ae5
commit
e0eeeaafcd
2 changed files with 13 additions and 4 deletions
|
@ -332,10 +332,10 @@ Elapsed time: %10v
|
||||||
// Add per transfer stats if required
|
// Add per transfer stats if required
|
||||||
if !fs.Config.StatsOneLine {
|
if !fs.Config.StatsOneLine {
|
||||||
if !s.checking.empty() {
|
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() {
|
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))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -63,12 +63,21 @@ func (ss *stringSet) count() int {
|
||||||
return len(ss.items)
|
return len(ss.items)
|
||||||
}
|
}
|
||||||
|
|
||||||
// String returns string representation of set items.
|
// String returns string representation of set items excluding any in
|
||||||
func (ss *stringSet) String(progress *inProgress) string {
|
// exclude (if set).
|
||||||
|
func (ss *stringSet) String(progress *inProgress, exclude *stringSet) string {
|
||||||
ss.mu.RLock()
|
ss.mu.RLock()
|
||||||
defer ss.mu.RUnlock()
|
defer ss.mu.RUnlock()
|
||||||
strngs := make([]string, 0, len(ss.items))
|
strngs := make([]string, 0, len(ss.items))
|
||||||
for name := range 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
|
var out string
|
||||||
if acc := progress.get(name); acc != nil {
|
if acc := progress.get(name); acc != nil {
|
||||||
out = acc.String()
|
out = acc.String()
|
||||||
|
|
Loading…
Add table
Reference in a new issue