Skip to content
This repository has been archived by the owner on Aug 29, 2020. It is now read-only.

Commit

Permalink
Fix unnecessary goroutine
Browse files Browse the repository at this point in the history
  • Loading branch information
cjbassi committed Dec 19, 2018
1 parent 2e6615b commit 6188e24
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions src/widgets/cpu.go
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
ticker := time.NewTicker(self.interval)
Expand All @@ -69,7 +69,6 @@ func NewCPU(interval time.Duration, zoom int, average bool, percpu bool) *CPU {
return self
}

// calculates the CPU usage over a 1 second interval and blocks for the duration
func (self *CPU) update() {
if self.Average {
go func() {
Expand Down

0 comments on commit 6188e24

Please sign in to comment.