mirror of
https://github.com/rclone/rclone
synced 2024-12-23 14:23:44 +01:00
rc: fix speed does not update in core/stats
This commit is contained in:
parent
448a03181f
commit
82ad9a30b9
@ -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()
|
||||
}
|
||||
|
@ -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]}
|
||||
|
Loading…
Reference in New Issue
Block a user