lib/events: Speed up event polling loop slightly (ref #3952)

GitHub-Pull-Request: https://github.com/syncthing/syncthing/pull/3954
This commit is contained in:
Jakob Borg 2017-02-04 15:53:39 +00:00
parent 81418d724a
commit 8cccecceba
1 changed files with 1 additions and 12 deletions

View File

@ -294,18 +294,7 @@ func NewBufferedSubscription(s *Subscription, size int) BufferedSubscription {
}
func (s *bufferedSubscription) pollingLoop() {
for {
ev, err := s.sub.Poll(60 * time.Second)
if err == ErrTimeout {
continue
}
if err == ErrClosed {
return
}
if err != nil {
panic("unexpected error: " + err.Error())
}
for ev := range s.sub.C() {
s.mut.Lock()
s.buf[s.next] = ev
s.next = (s.next + 1) % len(s.buf)