mirror of
				https://github.com/rclone/rclone.git
				synced 2025-10-30 23:17:59 +02:00 
			
		
		
		
	accounting: fix race clearing stats
This race was introduced by
10a6a92e52 accounting: reset bytes read during copy retry
			
			
This commit is contained in:
		| @@ -146,12 +146,16 @@ func (acc *Account) UpdateReader(in io.ReadCloser) { | ||||
| 	acc.close = in | ||||
| 	acc.origIn = in | ||||
| 	acc.closed = false | ||||
| 	acc.lpBytes = 0 | ||||
| 	acc.bytes = int64(0) | ||||
| 	if withBuf { | ||||
| 		acc.WithBuffer() | ||||
| 	} | ||||
| 	acc.mu.Unlock() | ||||
|  | ||||
| 	// Reset counter to stop percentage going over 100% | ||||
| 	acc.values.mu.Lock() | ||||
| 	acc.values.lpBytes = 0 | ||||
| 	acc.values.bytes = 0 | ||||
| 	acc.values.mu.Unlock() | ||||
| } | ||||
|  | ||||
| // averageLoop calculates averages for the stats in the background | ||||
|   | ||||
		Reference in New Issue
	
	Block a user