matcha icon indicating copy to clipboard operation
matcha copied to clipboard

BUG: N+1 query problem in email body fetching

Open andrinoff opened this issue 7 months ago • 2 comments

Describe the bug: Email bodies fetched one-by-one in loop. For inbox with 100 emails, makes 100 separate IMAP FETCH calls. Extremely slow on high-latency connections.

To reproduce:

  1. Open inbox with 100+ emails
  2. Monitor IMAP traffic
  3. See individual FETCH commands for each email
  4. Takes several minutes on slow connection

Expected behavior: Batch FETCH commands. Use IMAP sequence sets to fetch multiple bodies in single command.

Additional context:

  • File: fetcher/fetcher.go
  • Classic N+1 query antipattern
  • Should use "1:100" sequence sets
  • Need to handle IMAP response size limits
  • Severity: High - performance issue
  • Complexity: High - IMAP protocol knowledge required

andrinoff avatar Apr 16 '26 20:04 andrinoff

This has had no activity for 30 days. It will be closed in 14 days unless updated. Comment or remove the stale label to keep it open.

floatpanebot avatar May 17 '26 05:05 floatpanebot

Closing due to inactivity. Reopen if still relevant.

floatpanebot avatar May 31 '26 06:05 floatpanebot