mirror of
https://github.com/nxshock/gwp.git
synced 2025-04-19 01:11:51 +05:00
Compare commits
2 Commits
Author | SHA1 | Date | |
---|---|---|---|
161075bb83 | |||
0e63308e92 |
2
go.mod
2
go.mod
@ -3,6 +3,6 @@ module github.com/nxshock/gwp
|
|||||||
go 1.16
|
go 1.16
|
||||||
|
|
||||||
require (
|
require (
|
||||||
github.com/nxshock/go-eta v0.1.0
|
github.com/nxshock/go-eta v0.1.1
|
||||||
github.com/stretchr/testify v1.8.0
|
github.com/stretchr/testify v1.8.0
|
||||||
)
|
)
|
||||||
|
2
go.sum
2
go.sum
@ -3,6 +3,8 @@ github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c
|
|||||||
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||||
github.com/nxshock/go-eta v0.1.0 h1:rcy8rNPaVeL3f3c5rJRLvho0FErUJThD0+vihxA7t9c=
|
github.com/nxshock/go-eta v0.1.0 h1:rcy8rNPaVeL3f3c5rJRLvho0FErUJThD0+vihxA7t9c=
|
||||||
github.com/nxshock/go-eta v0.1.0/go.mod h1:hZ59FHIJSpPeZk38pd/3zUkI4H31hAQ2oFw+NgdU+SA=
|
github.com/nxshock/go-eta v0.1.0/go.mod h1:hZ59FHIJSpPeZk38pd/3zUkI4H31hAQ2oFw+NgdU+SA=
|
||||||
|
github.com/nxshock/go-eta v0.1.1 h1:N4wi3wjrXJGiheYF4zBIjOwugM+++NWsB1fpeRZaHS4=
|
||||||
|
github.com/nxshock/go-eta v0.1.1/go.mod h1:hZ59FHIJSpPeZk38pd/3zUkI4H31hAQ2oFw+NgdU+SA=
|
||||||
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
|
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
|
||||||
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
||||||
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
||||||
|
14
gwp.go
14
gwp.go
@ -42,7 +42,7 @@ func New(threadCount int) *WorkerPool {
|
|||||||
jobChan: make(chan func() error),
|
jobChan: make(chan func() error),
|
||||||
resultChan: make(chan error),
|
resultChan: make(chan error),
|
||||||
stopChan: make(chan struct{}),
|
stopChan: make(chan struct{}),
|
||||||
eta: eta.New(time.Minute, 0)}
|
eta: eta.New(0)}
|
||||||
|
|
||||||
workerPool.wg.Add(threadCount)
|
workerPool.wg.Add(threadCount)
|
||||||
|
|
||||||
@ -123,14 +123,12 @@ func (workerPool *WorkerPool) printProgress() error {
|
|||||||
workerPool.errorCount, float64(workerPool.errorCount*100)/float64(workerPool.estimateCount))
|
workerPool.errorCount, float64(workerPool.errorCount*100)/float64(workerPool.estimateCount))
|
||||||
}
|
}
|
||||||
|
|
||||||
if workerPool.currentSpeed > 0 {
|
if workerPool.estimateCount > 0 {
|
||||||
if workerPool.estimateCount > 0 {
|
fmt.Fprintf(buf, " ETA: %s", fmtDuration(time.Until(workerPool.eta.Average())))
|
||||||
fmt.Fprintf(buf, " ETA: %s", fmtDuration(time.Until(workerPool.eta.Average())))
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if workerPool.ShowSpeed {
|
if workerPool.currentSpeed > 0 && workerPool.ShowSpeed {
|
||||||
fmt.Fprintf(buf, " Speed: %.2f rps", workerPool.currentSpeed)
|
fmt.Fprintf(buf, " Speed: %.2f rps", workerPool.currentSpeed)
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fmt.Fprint(buf, endLine)
|
fmt.Fprint(buf, endLine)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user