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
|
var prevPos int
|
||||||
prevTime := time.Now()
|
prevTime := time.Now()
|
||||||
|
|
||||||
const calculateEtaPeriod = time.Minute
|
tickerUpdateText := time.NewTicker(defaultProgressUpdatePeriod)
|
||||||
|
tickerCalculateEta := time.NewTicker(defaultCalculateEtaPeriod)
|
||||||
tickerUpdateText := time.NewTicker(time.Second)
|
|
||||||
tickerCalculateEta := time.NewTicker(calculateEtaPeriod)
|
|
||||||
defer func() {
|
defer func() {
|
||||||
tickerUpdateText.Stop()
|
tickerUpdateText.Stop()
|
||||||
tickerCalculateEta.Stop()
|
tickerCalculateEta.Stop()
|
||||||
}()
|
}()
|
||||||
|
|
||||||
var currentSpeed float64 // items per sec
|
var currentSpeed float64 // jobs per sec
|
||||||
|
|
||||||
fmt.Fprintf(os.Stderr, endLine)
|
fmt.Fprintf(os.Stderr, endLine)
|
||||||
for {
|
for {
|
||||||
|
Loading…
Reference in New Issue
Block a user