Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions fetcher/idle.go
Original file line number Diff line number Diff line change
Expand Up @@ -158,8 +158,17 @@ func (a *accountIdle) idleOnce() error {
mailboxUpdates := make(chan uint32, 32)
c, err := connectWithHandler(a.account, &imapclient.UnilateralDataHandler{
Mailbox: func(data *imapclient.UnilateralDataMailbox) {
if data.NumMessages != nil {
mailboxUpdates <- *data.NumMessages
if data.NumMessages == nil {
return
}
// Non-blocking send: the callback runs on the IMAP socket-reader
// goroutine, so a synchronous send would stall the socket if the
// channel is full. The consumer only acts on the latest count
// (see prevExists tracking below), so dropping a stale update is
// safe — the next update will deliver the current count.
select {
case mailboxUpdates <- *data.NumMessages:
default:
}
},
})
Expand Down
Loading