perf: optimize email fetching with SSE, caching, and concurrent IMAP#36
Open
EucalyZ wants to merge 1 commit into
Open
perf: optimize email fetching with SSE, caching, and concurrent IMAP#36EucalyZ wants to merge 1 commit into
EucalyZ 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>
Owner
|
审查中 |
Owner
|
感谢你的贡献!这个 PR 在性能优化方向上的思路很有价值,特别是以下几点我们非常认可:
不过在代码审查中我们发现了一些需要关注的问题,目前不适合直接合并: 1.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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