1
0
mirror of https://github.com/rclone/rclone.git synced 2025-12-16 00:04:40 +00:00

fs/accounting: add option to delete stats

Removed PruneAllTransfers because it had no use. startedTransfers are
set to nil in ResetCounters.
This commit is contained in:
Aleksandar Jankovic
2019-12-19 11:16:22 +01:00
committed by Nick Craig-Wood
parent 0e64df4b4c
commit b9fb313f71
4 changed files with 158 additions and 41 deletions

View File

@@ -431,25 +431,3 @@ func TestPruneTransfers(t *testing.T) {
})
}
}
func TestPruneAllTransfers(t *testing.T) {
const transfers = 10
s := NewStats()
for i := int64(1); i <= int64(transfers); i++ {
s.AddTransfer(&Transfer{
startedAt: time.Unix(i, 0),
completedAt: time.Unix(i+1, 0),
})
}
s.mu.Lock()
assert.Equal(t, transfers, len(s.startedTransfers))
s.mu.Unlock()
s.PruneAllTransfers()
s.mu.Lock()
assert.Empty(t, s.startedTransfers)
s.mu.Unlock()
}