"rsync for cloud storage" - Google Drive, S3, Dropbox, Backblaze B2, One Drive, Swift, Hubic, Wasabi, Google Cloud Storage, Azure Blob, Azure Files, Yandex Files
Go azure-blobazure-blob-storageazure-filesbackblaze-b2cloud-storagedropboxencryptionftpfuse-filesystemgogolanggoogle-cloud-storagegoogle-driveonedriveopenstack-swiftrclones3sftpsyncwebdav
accounting: fix unknown length file transfers count 3 transfers each #6213
buda517e7d927199
diff --git a/fs/accounting/stats.go b/fs/accounting/stats.goindex b4b32a8ee..fc17f95ac 100644--- a/fs/accounting/stats.go+++ b/fs/accounting/stats.go@@ -714,10 +714,10 @@ func (s *StatsInfo) NewTransferRemoteSize(remote string, size int64) *Transfer {// DoneTransferring removes a transfer from the stats//-// if ok is true then it increments the transfers count+// if ok is true and it was in the transfermap (to avoid incrementing in case of nested calls, #6213) then it increments the transfers countfunc (s *StatsInfo) DoneTransferring(remote string, ok bool) {- s.transferring.del(remote)- if ok {+ existed := s.transferring.del(remote)+ if ok && existed {s.mu.Lock()s.transfers++s.mu.Unlock()diff --git a/fs/accounting/transfermap.go b/fs/accounting/transfermap.goindex ed64bf369..4fb30a079 100644--- a/fs/accounting/transfermap.go+++ b/fs/accounting/transfermap.go@@ -34,10 +34,13 @@ func (tm *transferMap) add(tr *Transfer) {}// del removes a transfer from the map by name-func (tm *transferMap) del(remote string) {+func (tm *transferMap) del(remote string) bool {tm.mu.Lock()+ _, exists := tm.items[remote]delete(tm.items, remote)tm.mu.Unlock()++ return exists}// merge adds items from another map