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,19 +203,17 @@ 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:
break loop triggered = true
case <-s.testWaitCh: case <-s.testWaitCh:
} }
} }
} }
}
// targetChanged returns true if a registered target data structure has been // targetChanged returns true if a registered target data structure has been
// changed since the last call to this function. // changed since the last call to this function.