perf: optimize email fetching with SSE, caching, and concurrent IMAP - #36
perf: optimize email fetching with SSE, caching, and concurrent IMAP#36EucalyZ wants to merge 1 commit into
Conversation
…concurrent IMAP - Skip Graph API for accounts without Mail.Read permission (check token scope) - Cache account channel (graph/imap) in memory with 1h TTL to avoid repeated probing - Add server-side email list cache with 2h TTL to eliminate redundant fetches - SSE streaming endpoint (/api/emails/<email>/stream) for progressive email rendering - Concurrent IMAP: try both outlook.live.com and outlook.office365.com simultaneously - Batch IMAP FETCH: single request for all messages instead of N sequential fetches - Gunicorn: switch to gthread worker with 8 threads for concurrent request handling - Fix cached method name matching (use includes() instead of strict equality) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
|
审查中 |
|
感谢你的贡献!这个 PR 在性能优化方向上的思路很有价值,特别是以下几点我们非常认可:
不过在代码审查中我们发现了一些需要关注的问题,目前不适合直接合并: 1.
|
|
Migration note: I reviewed this PR during the #109 migration pass, but did not include it in #112. Reason: #36 is a broader SSE/cache/controller rewrite and also touches the old frontend email surface. Applying it wholesale onto the Ant Design Pro SPA branch would mix a larger architecture change into the backend migration PR. It should be handled as a separate follow-up after #109 stabilizes. |
发版处置结论本 PR 不纳入本次发版,现关闭。 原因
后续保留性能优化方向,后续独立评估 SSE、缓存和 IMAP 并发方案。 |
处置更新根据当前版本规划,PR #36 不关闭,保留作为后续邮件获取性能优化方向。 当前发版范围
后续计划
本 PR 状态调整为:保留,延期到后续版本处理。 |
发布线路归类
本次仅调整发布归类,不关闭该 PR。 |
Summary
Mail.Readpermission — check token scope after refresh, avoid wasting ~1.5s on guaranteed-401 requests/api/emails/<email>/stream) — IMAP emails rendered progressively as each message arrives (~5s to first email instead of waiting 30s for all)outlook.live.comandoutlook.office365.comsimultaneously, use whichever connects firstincludes()vs===) preventing email detail fetch after cache hitPerformance comparison
Test plan
(cached)in method tag)获取邮件button) bypasses cache🤖 Generated with Claude Code