diff --git a/fs/accounting/stats_groups.go b/fs/accounting/stats_groups.go index 421fabfc3..cde662645 100644 --- a/fs/accounting/stats_groups.go +++ b/fs/accounting/stats_groups.go @@ -375,6 +375,9 @@ func (sg *statsGroups) sum(ctx context.Context) *StatsInfo { sum.startedTransfers = append(sum.startedTransfers, stats.startedTransfers...) sum.oldDuration += stats.oldDuration sum.oldTimeRanges = append(sum.oldTimeRanges, stats.oldTimeRanges...) + stats.average.mu.Lock() + sum.average.speed += stats.average.speed + stats.average.mu.Unlock() } stats.mu.RUnlock() } diff --git a/fs/accounting/stats_groups_test.go b/fs/accounting/stats_groups_test.go index 8d3673a56..b8898b80e 100644 --- a/fs/accounting/stats_groups_test.go +++ b/fs/accounting/stats_groups_test.go @@ -62,6 +62,7 @@ func TestStatsGroupOperations(t *testing.T) { assert.Equal(t, stats1.bytes+stats2.bytes, sum.bytes) assert.Equal(t, stats1.errors+stats2.errors, sum.errors) assert.Equal(t, stats1.oldDuration+stats2.oldDuration, sum.oldDuration) + assert.Equal(t, stats1.average.speed+stats2.average.speed, sum.average.speed) // dict can iterate in either order a := timeRanges{stats1.oldTimeRanges[0], stats2.oldTimeRanges[0]} b := timeRanges{stats2.oldTimeRanges[0], stats1.oldTimeRanges[0]}