From 9ef9354b680fc915c6d3b3fed1e8657428bebf3a Mon Sep 17 00:00:00 2001 From: velvettear Date: Thu, 7 Sep 2023 15:47:51 +0200 Subject: [PATCH] start an rsync process for every file found if no concurrency is set --- settings/arguments.go | 3 --- tools/rsync.go | 6 +++++- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/settings/arguments.go b/settings/arguments.go index f0de907..ca485ab 100644 --- a/settings/arguments.go +++ b/settings/arguments.go @@ -64,9 +64,6 @@ func Initialize() { } setSource(arguments[0]) setTarget(arguments[1]) - if Concurrency == 0 { - setConcurrency(runtime.NumCPU()) - } _, error := os.Stat(Source) if os.IsNotExist(error) { log.Fatal("given source does not exist", Source) diff --git a/tools/rsync.go b/tools/rsync.go index 3734815..daa2bc7 100644 --- a/tools/rsync.go +++ b/tools/rsync.go @@ -32,7 +32,11 @@ func Transfer() { timestamp := time.Now() counter := 0 totalbar := createProgressBar(barcontainer, "Total", int64(0), int64(sourcefilesCount), sourcefilesCount+1, true) - channel := make(chan struct{}, settings.Concurrency) + concurrency := settings.Concurrency + if concurrency == 0 { + concurrency = sourcefilesCount + } + channel := make(chan struct{}, concurrency) for index, file := range sourcefiles { channel <- struct{}{} if index > 0 {