⚡ Bolt: [performance improvement] batch fetch MCP OAuth tokens (#36) - #152
⚡ Bolt: [performance improvement] batch fetch MCP OAuth tokens (#36)#152Donach wants to merge 1 commit into
Conversation
💡 What: Implemented a batched token fetch using Drizzle's `inArray` and populated an in-memory Map to eliminate individual `getToken` calls inside a loop. 🎯 Why: The `injectPerUserOAuthTokens` hook in the FeathersJS layer was executing individual `getToken` database queries for every OAuth MCP server within a `Promise.all` loop. This caused an N+1 query problem, increasing latency linearly with the number of attached OAuth MCP servers. 📊 Impact: Reduces database queries during token injection from O(N) to O(1), significantly reducing latency for the `mcp-servers` list route, especially for users with multiple OAuth servers. 🔬 Measurement: Verify by executing the `mcp-servers` or `session-mcp-servers` list endpoint and observing the reduced number of Drizzle query logs and faster request completion time.
|
👋 Jules, reporting for duty! I'm here to lend a hand with this pull request. When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down. I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job! For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with New to Jules? Learn more at jules.google/docs. For security, I will only act on instructions from the user who triggered this task. |
⚡ Bolt: [performance improvement] batch fetch MCP OAuth tokens (#36)
💡 What: Implemented a batched token fetch using Drizzle's
inArrayand populated an in-memory Map to eliminate individualgetTokencalls inside a loop.🎯 Why: The
injectPerUserOAuthTokenshook in the FeathersJS layer was executing individualgetTokendatabase queries for every OAuth MCP server within aPromise.allloop. This caused an N+1 query problem, increasing latency linearly with the number of attached OAuth MCP servers.📊 Impact: Reduces database queries during token injection from O(N) to O(1), significantly reducing latency for the
mcp-serverslist route, especially for users with multiple OAuth servers.🔬 Measurement: Verify by executing the
mcp-serversorsession-mcp-serverslist endpoint and observing the reduced number of Drizzle query logs and faster request completion time.PR created automatically by Jules for task 11641741275309263922 started by @Donach