events: don't enter a busy loop on error

Closes: https://github.com/emersion/hydroxide/issues/56
This commit is contained in:
Simon Ser 2019-06-22 12:56:15 +03:00
parent 6d69d5ef72
commit f0d0d64b4f
No known key found for this signature in database
GPG Key ID: 0FDE7BE0E88F5E48
1 changed files with 4 additions and 0 deletions

View File

@ -28,6 +28,10 @@ func (r *Receiver) receiveEvents() {
event, err := r.c.GetEvent(last)
if err != nil {
log.Println("cannot receive event:", err)
select {
case <-t.C:
case <-r.poll:
}
continue
}
last = event.ID