"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
fs: Fix transferTime not being set in JSON logs
Jacob Handscf5457c2cd03
diff --git a/fs/accounting/stats.go b/fs/accounting/stats.goindex 0faa74180..24c9bcda1 100644--- a/fs/accounting/stats.go+++ b/fs/accounting/stats.go@@ -313,6 +313,8 @@ func (s *StatsInfo) calculateTransferStats() (ts transferStats) {// we take it off here to avoid double countingts.totalBytes = s.transferQueueSize + s.bytes + transferringBytesTotal - transferringBytesDonets.speed = s.average.speed+ dt := s.totalDuration()+ ts.transferTime = dt.Seconds()return ts}diff --git a/fs/accounting/stats_test.go b/fs/accounting/stats_test.goindex 58e8150bd..773311824 100644--- a/fs/accounting/stats_test.go+++ b/fs/accounting/stats_test.go@@ -251,6 +251,28 @@ func TestStatsTotalDuration(t *testing.T) {})}+func TestRemoteStats(t *testing.T) {+ ctx := context.Background()+ startTime := time.Now()+ time1 := startTime.Add(-40 * time.Second)+ time2 := time1.Add(10 * time.Second)++ t.Run("Single completed transfer", func(t *testing.T) {+ s := NewStats(ctx)+ tr1 := &Transfer{+ startedAt: time1,+ completedAt: time2,+ }+ s.AddTransfer(tr1)+ time.Sleep(time.Millisecond)+ rs, err := s.RemoteStats()++ require.NoError(t, err)+ assert.Equal(t, float64(10), rs["transferTime"])+ assert.Greater(t, rs["elapsedTime"], float64(0))+ })+}+// make time ranges from string description for testingfunc makeTimeRanges(t *testing.T, in []string) timeRanges {trs := make(timeRanges, len(in))