fix(mail): drain UidFetch channel on early error; clarify ParseHeaderOnly doc
If header/body parsing errored mid-fetch we returned without draining the message channel, so the UidFetch goroutine could block on a full channel. Both fetch paths now break, drain remaining messages, then read the done error. Verified with the race detector. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -95,7 +95,9 @@ func ParseMessage(uid uint32, raw []byte) (Message, error) {
|
||||
return m, nil
|
||||
}
|
||||
|
||||
// ParseHeaderOnly decodes headers and detects attachments without keeping bodies.
|
||||
// ParseHeaderOnly parses a full RFC822 message (raw bytes) and returns only the
|
||||
// Header, with HasAttachments set. For IMAP BODY[HEADER]-only bytes (no body),
|
||||
// use ParseHeaderBytes instead, which avoids downloading the body entirely.
|
||||
func ParseHeaderOnly(uid uint32, raw []byte) (Header, error) {
|
||||
m, err := ParseMessage(uid, raw)
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user