beacon/light/request: nicer trigger wait loop

Co-authored-by: Martin HS <martin@swende.se>
This commit is contained in:
Felföldi Zsolt 2024-02-01 13:15:20 +01:00 committed by GitHub
parent eceba4c6f7
commit 7fa0a003d3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 8 additions and 10 deletions

View File

@ -203,16 +203,14 @@ func (s *Scheduler) syncLoop() {
s.lock.Lock() s.lock.Lock()
s.processRound() s.processRound()
s.lock.Unlock() s.lock.Unlock()
loop: for triggered := false; !triggered; {
for { select {
select { case stop := <-s.stopCh:
case stop := <-s.stopCh: close(stop)
close(stop) return
return case <-s.triggerCh:
case <-s.triggerCh: triggered = true
break loop case <-s.testWaitCh:
case <-s.testWaitCh:
}
} }
} }
} }