mirror of
https://github.com/nxshock/gwp.git
synced 2025-07-01 00:13:39 +05:00
Move consts to separate file
This commit is contained in:
parent
0ae81d5570
commit
4c690762bd
2 changed files with 11 additions and 5 deletions
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…
Add table
Add a link
Reference in a new issue