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:
parent
0ae81d5570
commit
4c690762bd
8
consts.go
Normal file
8
consts.go
Normal file
@ -0,0 +1,8 @@
|
||||
package gwp
|
||||
|
||||
import "time"
|
||||
|
||||
const (
|
||||
defaultProgressUpdatePeriod = time.Second
|
||||
defaultCalculateEtaPeriod = time.Minute
|
||||
)
|
8
gwp.go
8
gwp.go
@ -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 {
|
||||
|
Loading…
Reference in New Issue
Block a user