Skip to content

"rsync for cloud storage" - Google Drive, S3, Dropbox, Backblaze B2, One Drive, Swift, Hubic, Wasabi, Google Cloud Storage, Azure Blob, Azure Files, Yandex Files

accounting: stabilize display order of transfers on Windows

Nick Craig-Wood433b73a5a863
diff --git a/fs/accounting/transfermap.go b/fs/accounting/transfermap.go
index ce145ae38..a9b9c6700 100644
--- a/fs/accounting/transfermap.go
+++ b/fs/accounting/transfermap.go
@@ -72,8 +72,16 @@ func (tm *transferMap) _sortedSlice() []*Transfer {
for _, tr := range tm.items {
s = append(s, tr)
}
+ // sort by time first and if equal by name. Note that the relatively
+ // low time resolution on Windows can cause equal times.
sort.Slice(s, func(i, j int) bool {
- return s[i].startedAt.Before(s[j].startedAt)
+ a, b := s[i], s[j]
+ if a.startedAt.Before(b.startedAt) {
+ return true
+ } else if !a.startedAt.Equal(b.startedAt) {
+ return false
+ }
+ return a.remote < b.remote
})
return s
}