1
0
mirror of https://github.com/nxshock/gwp.git synced 2024-11-27 03:31:02 +05:00

Do now print new line if no progress requested

This commit is contained in:
nxshock 2022-03-07 16:10:43 +05:00
parent 35416cd502
commit 5b2fc6d56d

8
gwp.go
View File

@ -48,10 +48,16 @@ func New(threadCount int) *WorkerPool {
tickerCalculateEta.Stop() tickerCalculateEta.Stop()
}() }()
fmt.Fprintf(os.Stderr, endLine) newLined := false
for { for {
select { select {
case <-tickerUpdateText.C: case <-tickerUpdateText.C:
if !newLined {
fmt.Fprintf(os.Stderr, endLine)
newLined = true
}
workerPool.printProgress() workerPool.printProgress()
case <-tickerCalculateEta.C: case <-tickerCalculateEta.C:
workerPool.currentSpeed = float64(workerPool.processedCount-prevPos) * float64(time.Second) / float64(time.Now().Sub(prevTime)) workerPool.currentSpeed = float64(workerPool.processedCount-prevPos) * float64(time.Second) / float64(time.Now().Sub(prevTime))