diff --git a/internal/store/change.go b/internal/store/change.go index d4722a45..ee58e5bb 100644 --- a/internal/store/change.go +++ b/internal/store/change.go @@ -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):