Commit Graph

2 Commits

Author SHA1 Message Date
2f9604620f Fix gt mail inbox performance: bypass daemon for mail queries
Some checks failed
CI / Check for .beads changes (push) Has been skipped
CI / Check embedded formulas (push) Successful in 20s
CI / Test (push) Failing after 1m23s
CI / Lint (push) Successful in 17s
CI / Integration Tests (push) Successful in 1m1s
CI / Coverage Report (push) Has been skipped
Windows CI / Windows Build and Unit Tests (push) Has been cancelled
Mail operations were taking 30+ seconds due to beads daemon auto-import
cycles. Each bd query would wait up to 5 seconds for auto-import to
complete, and with 3+ queries per inbox check, this added up.

The fix bypasses the daemon by passing --no-daemon to all bd commands
in the mail package. This is appropriate because:
- Mail queries are read-heavy and don't benefit from daemon caching
- Direct SQLite access is faster for one-off queries
- Avoids daemon auto-import/export cycle delays

Performance improvement: 31+ seconds → 1.2 seconds

Fixes: hq-b1o08

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-21 16:23:45 -08:00
road-warrior
4ebb96fbbc refactor: Extract runBdCommand helper to DRY mail package (gt-8i6bg)
Extracted duplicate bd command execution pattern from mailbox.go and
router.go into a new helper function in bd.go. This reduces code
duplication and provides consistent error handling via the bdError type.

Changes:
- Added internal/mail/bd.go with runBdCommand helper and bdError type
- Refactored 5 functions in mailbox.go to use runBdCommand
- Refactored 5 functions in router.go to use runBdCommand
- Net reduction of 55 lines of code

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-05 00:18:05 -08:00