mirror of
https://github.com/ProtonMail/proton-bridge.git
synced 2025-12-18 08:06:59 +00:00
Timeout for sending IMAP update
This commit is contained in:
@ -123,8 +123,16 @@ func (store *Store) imapSendUpdate(update imapBackend.Update) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
done := update.Done()
|
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 {
|
select {
|
||||||
case <-done:
|
case <-done:
|
||||||
case <-time.After(1 * time.Second):
|
case <-time.After(1 * time.Second):
|
||||||
|
|||||||
Reference in New Issue
Block a user