mirror of
https://github.com/rclone/rclone.git
synced 2024-11-28 11:25:18 +01:00
accounting: fix race detected by the race detector
This commit is contained in:
parent
d08b49d723
commit
10270a4354
@ -313,7 +313,9 @@ func (s *StatsInfo) calculateTransferStats() (ts transferStats) {
|
|||||||
// note that s.bytes already includes transferringBytesDone so
|
// note that s.bytes already includes transferringBytesDone so
|
||||||
// we take it off here to avoid double counting
|
// we take it off here to avoid double counting
|
||||||
ts.totalBytes = s.transferQueueSize + s.bytes + transferringBytesTotal - transferringBytesDone
|
ts.totalBytes = s.transferQueueSize + s.bytes + transferringBytesTotal - transferringBytesDone
|
||||||
|
s.average.mu.Lock()
|
||||||
ts.speed = s.average.speed
|
ts.speed = s.average.speed
|
||||||
|
s.average.mu.Unlock()
|
||||||
dt := s._totalDuration()
|
dt := s._totalDuration()
|
||||||
ts.transferTime = dt.Seconds()
|
ts.transferTime = dt.Seconds()
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user