Fix unnecessary goroutine
This commit is contained in:
parent
2e6615bc7b
commit
6188e24c73
|
@ -57,7 +57,7 @@ func NewCPU(interval time.Duration, zoom int, average bool, percpu bool) *CPU {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
go self.update() // update asynchronously because of 1 second blocking period
|
self.update()
|
||||||
|
|
||||||
go func() {
|
go func() {
|
||||||
ticker := time.NewTicker(self.interval)
|
ticker := time.NewTicker(self.interval)
|
||||||
|
@ -69,7 +69,6 @@ func NewCPU(interval time.Duration, zoom int, average bool, percpu bool) *CPU {
|
||||||
return self
|
return self
|
||||||
}
|
}
|
||||||
|
|
||||||
// calculates the CPU usage over a 1 second interval and blocks for the duration
|
|
||||||
func (self *CPU) update() {
|
func (self *CPU) update() {
|
||||||
if self.Average {
|
if self.Average {
|
||||||
go func() {
|
go func() {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user