Skip to content

Commit

Permalink
Replaced doneChan chan bool with chan struct{}
Browse files Browse the repository at this point in the history
Signed-off-by: Adolfo García Veytia (Puerco) <adolfo.garcia@uservers.net>
  • Loading branch information
derekperkins authored and puerco committed Jul 23, 2024
1 parent b008968 commit da4f04a
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions throttler/throttler.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ type Throttler struct {
totalJobs int
jobsStarted int
jobsCompleted int
doneChan chan bool
doneChan chan struct{}
}

// New returns a Throttler that will govern the max number of workers and will
Expand All @@ -26,7 +26,7 @@ func New(maxWorkers, totalJobs int) *Throttler {
return &Throttler{
maxWorkers: maxWorkers,
totalJobs: totalJobs,
doneChan: make(chan bool, totalJobs),
doneChan: make(chan struct{}, totalJobs),
}
}

Expand Down Expand Up @@ -60,5 +60,5 @@ func (t *Throttler) Throttle() {
// can be activated. If Done is called less times than totalJobs,
// Throttle will block forever
func (t *Throttler) Done() {
t.doneChan <- true
t.doneChan <- struct{}{}
}

0 comments on commit da4f04a

Please sign in to comment.