march: fix --no-traverse being very slow - fixes #8860

Before this change --no-traverse was calling NewObject on directories
(where it would always fail) as well as files. This was very
noticeable when doing syncs with --max-age which were only
transferring a small number of objects. This should have been very
quick, but the NewObject calls for each directory slowed the sync down
a lot.

This changes replaces the check to see if the source entry is an
Object that got missed out from this commit:

88e30eecbf march: fix deadlock when using --no-traverse - fixes #8656
This commit is contained in:
Nick Craig-Wood
2025-10-22 12:28:06 +01:00
parent b8700e8042
commit b272c50c4c

View File

@@ -455,6 +455,11 @@ func (m *March) processJob(job listDirJob) ([]listDirJob, error) {
go func() {
defer workerWg.Done()
for t := range matchTasks {
// Can't match directories with NewObject
if _, ok := t.src.(fs.Object); !ok {
t.dstMatch <- nil
continue
}
leaf := path.Base(t.src.Remote())
dst, err := m.Fdst.NewObject(m.Ctx, path.Join(job.dstRemote, leaf))
if err != nil {