fixed order of the progress bars
This commit is contained in:
parent
7bdce49c72
commit
0804fadbb5
2 changed files with 9 additions and 8 deletions
4
.vscode/launch.json
vendored
4
.vscode/launch.json
vendored
|
@ -30,7 +30,9 @@
|
|||
"--password",
|
||||
"$Velvet90",
|
||||
"--concurrency",
|
||||
"4",
|
||||
"12",
|
||||
"--delay",
|
||||
"250",
|
||||
"--verbose",
|
||||
],
|
||||
"console": "integratedTerminal"
|
||||
|
|
|
@ -43,24 +43,23 @@ func Transfer() {
|
|||
if concurrency == 0 {
|
||||
concurrency = sourcefilesCount
|
||||
}
|
||||
first := true
|
||||
index := 0
|
||||
channel := make(chan struct{}, concurrency)
|
||||
for file, size := range sourcefiles {
|
||||
channel <- struct{}{}
|
||||
if !first {
|
||||
if index > 0 {
|
||||
time.Sleep(settings.Delay)
|
||||
} else {
|
||||
first = false
|
||||
}
|
||||
go func(file string, size int64) {
|
||||
go func(file string, size int64, index int) {
|
||||
defer waitgroup.Done()
|
||||
bar := createProgressBar(barcontainer, filepath.Base(file), size, int64(100), counter, false)
|
||||
bar := createProgressBar(barcontainer, filepath.Base(file), size, int64(100), index, false)
|
||||
if transferFile(bar, file) {
|
||||
counter++
|
||||
}
|
||||
totalbar.Increment()
|
||||
<-channel
|
||||
}(file, size)
|
||||
}(file, size, index)
|
||||
index++
|
||||
}
|
||||
barcontainer.Wait()
|
||||
timeDifference := time.Since(timestamp)
|
||||
|
|
Loading…
Reference in a new issue