Reverted sending IMAP updates to be not blocking again

This commit is contained in:
Michal Horejsek
2020-10-05 11:00:50 +02:00
parent b12873f1df
commit 7ff67f2217
2 changed files with 7 additions and 14 deletions

View File

@ -4,6 +4,11 @@ Changelog [format](http://keepachangelog.com/en/1.0.0/)
## Unreleased
## [Bridge 1.4.3] Forth
### Changed
* Reverted sending IMAP updates to be not blocking again.
## [Bridge 1.4.2] Forth
### Changed

View File

@ -122,22 +122,10 @@ func (store *Store) imapSendUpdate(update imapBackend.Update) {
return
}
done := update.Done()
go func() {
// This timeout is to not keep running many blocked goroutines.
// In case nothing listens to this channel, this thread should stop.
select {
case store.imapUpdates <- update:
case <-time.After(1 * time.Second):
store.log.Warn("IMAP update could not be sent (timeout).")
}
}()
// This timeout is to not block IMAP backend by wait for IMAP client.
select {
case <-done:
case <-time.After(1 * time.Second):
store.log.Warn("IMAP update could not be delivered (timeout).")
store.log.Warn("IMAP update could not be sent (timeout)")
return
case store.imapUpdates <- update:
}
}