Browse Source

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

GitHub-Pull-Request: https://github.com/syncthing/syncthing/pull/3954
Jakob Borg 9 years ago
parent
commit
8cccecceba
1 changed files with 1 additions and 12 deletions
  1. 1 12
      lib/events/events.go

+ 1 - 12
lib/events/events.go

@@ -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)