1
mirror of https://github.com/rclone/rclone synced 2024-12-23 14:23:44 +01:00

accounting: fix race detected by the race detector

This commit is contained in:
Nick Craig-Wood 2024-06-18 12:12:26 +01:00
parent d08b49d723
commit 10270a4354

View File

@ -313,7 +313,9 @@ func (s *StatsInfo) calculateTransferStats() (ts transferStats) {
// note that s.bytes already includes transferringBytesDone so
// we take it off here to avoid double counting
ts.totalBytes = s.transferQueueSize + s.bytes + transferringBytesTotal - transferringBytesDone
s.average.mu.Lock()
ts.speed = s.average.speed
s.average.mu.Unlock()
dt := s._totalDuration()
ts.transferTime = dt.Seconds()