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

Move consts to separate file

This commit is contained in:
nxshock 2021-02-03 20:57:44 +05:00
parent 0ae81d5570
commit 4c690762bd
2 changed files with 11 additions and 5 deletions

8
consts.go Normal file
View File

@ -0,0 +1,8 @@
package gwp
import "time"
const (
defaultProgressUpdatePeriod = time.Second
defaultCalculateEtaPeriod = time.Minute
)

8
gwp.go
View File

@ -37,16 +37,14 @@ func New(threadCount int) *WorkerPool {
var prevPos int
prevTime := time.Now()
const calculateEtaPeriod = time.Minute
tickerUpdateText := time.NewTicker(time.Second)
tickerCalculateEta := time.NewTicker(calculateEtaPeriod)
tickerUpdateText := time.NewTicker(defaultProgressUpdatePeriod)
tickerCalculateEta := time.NewTicker(defaultCalculateEtaPeriod)
defer func() {
tickerUpdateText.Stop()
tickerCalculateEta.Stop()
}()
var currentSpeed float64 // items per sec
var currentSpeed float64 // jobs per sec
fmt.Fprintf(os.Stderr, endLine)
for {