mirror of
https://github.com/octoleo/syncthing.git
synced 2024-12-22 19:08:58 +00:00
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:
parent
81418d724a
commit
8cccecceba
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user