accounting: fix startTime of statsGroups.sum

This commit is contained in:
Haochen Tong 2021-06-14 00:32:44 +08:00 committed by Nick Craig-Wood
parent 1cc6dd349e
commit d2050523de

View File

@ -2,9 +2,8 @@ package accounting
import ( import (
"context" "context"
"sync"
"github.com/rclone/rclone/fs/rc" "github.com/rclone/rclone/fs/rc"
"sync"
"github.com/rclone/rclone/fs" "github.com/rclone/rclone/fs"
) )
@ -349,6 +348,7 @@ func (sg *statsGroups) names() []string {
// sum returns aggregate stats that contains summation of all groups. // sum returns aggregate stats that contains summation of all groups.
func (sg *statsGroups) sum(ctx context.Context) *StatsInfo { func (sg *statsGroups) sum(ctx context.Context) *StatsInfo {
startTime := GlobalStats().startTime
sg.mu.Lock() sg.mu.Lock()
defer sg.mu.Unlock() defer sg.mu.Unlock()
@ -377,6 +377,7 @@ func (sg *statsGroups) sum(ctx context.Context) *StatsInfo {
} }
stats.mu.RUnlock() stats.mu.RUnlock()
} }
sum.startTime = startTime
return sum return sum
} }