Skip to content

Commit

Permalink
Avoid repeatedly unlocking and locking Throttler on start
Browse files Browse the repository at this point in the history
  • Loading branch information
sersorrel committed Feb 6, 2024
1 parent af84b03 commit 43cb9df
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions reindex/throttle.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,7 @@ func (t *Throttler) Start() {
defer t.Unlock()

if t.started {
t.Unlock()
t.Stop()
t.Lock()
t.stop()
}

t.requestedStop = make(chan struct{})
Expand Down Expand Up @@ -150,6 +148,10 @@ func (t *Throttler) Stop() {
t.Lock()
defer t.Unlock()

t.stop()
}

func (t *Throttler) stop() {
if t.stopped {
return
}
Expand Down

0 comments on commit 43cb9df

Please sign in to comment.