forked from Silverfish/proton-bridge
Timeout for sending IMAP update
This commit is contained in:
@ -123,8 +123,16 @@ func (store *Store) imapSendUpdate(update imapBackend.Update) {
|
||||
}
|
||||
|
||||
done := update.Done()
|
||||
go func() { store.imapUpdates <- update }()
|
||||
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):
|
||||
}
|
||||
}()
|
||||
|
||||
// This timeout is to not block IMAP backend by wait for IMAP client.
|
||||
select {
|
||||
case <-done:
|
||||
case <-time.After(1 * time.Second):
|
||||
|
||||
Reference in New Issue
Block a user