File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -158,8 +158,17 @@ func (a *accountIdle) idleOnce() error {
158158 mailboxUpdates := make (chan uint32 , 32 )
159159 c , err := connectWithHandler (a .account , & imapclient.UnilateralDataHandler {
160160 Mailbox : func (data * imapclient.UnilateralDataMailbox ) {
161- if data .NumMessages != nil {
162- mailboxUpdates <- * data .NumMessages
161+ if data .NumMessages == nil {
162+ return
163+ }
164+ // Non-blocking send: the callback runs on the IMAP socket-reader
165+ // goroutine, so a synchronous send would stall the socket if the
166+ // channel is full. The consumer only acts on the latest count
167+ // (see prevExists tracking below), so dropping a stale update is
168+ // safe — the next update will deliver the current count.
169+ select {
170+ case mailboxUpdates <- * data .NumMessages :
171+ default :
163172 }
164173 },
165174 })
You can’t perform that action at this time.
0 commit comments