start an rsync process for every file found if no concurrency is set

This commit is contained in:
Daniel Sommer 2023-09-07 15:47:51 +02:00
parent 5b2cb24556
commit 9ef9354b68
2 changed files with 5 additions and 4 deletions

View file

@ -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)

View file

@ -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 {