diff --git a/src/lib/forge-mission-board.ts b/src/lib/forge-mission-board.ts index 7992719f..4517ade9 100644 --- a/src/lib/forge-mission-board.ts +++ b/src/lib/forge-mission-board.ts @@ -121,18 +121,21 @@ export type MissionBoardOverview = { export async function getMissionBoardOverview(): Promise { const { db, Request, AgentAppIssue, AgentTask, TechWatchSuggestion, Project } = await loadAstroDb(); - const projects = await db.select().from(Project); + // ⚡ Bolt Optimization: Group independent queries using Promise.all to execute concurrently. + // This reduces the total database wait time to the longest single query. + const [projects, requests, issues, tasks, techRows] = await Promise.all([ + db.select().from(Project), + db.select().from(Request).orderBy(desc(Request.id)).limit(300), + db.select().from(AgentAppIssue).orderBy(desc(AgentAppIssue.id)).limit(300), + db.select().from(AgentTask).limit(800), + TechWatchSuggestion + ? db.select().from(TechWatchSuggestion).orderBy(desc(TechWatchSuggestion.id)).limit(200) + : Promise.resolve([]), + ]); + const projectNames: Record = {}; for (const p of projects) projectNames[p.id] = String(p.name || ''); - const requests = await db.select().from(Request).orderBy(desc(Request.id)).limit(300); - const issues = await db.select().from(AgentAppIssue).orderBy(desc(AgentAppIssue.id)).limit(300); - const tasks = await db.select().from(AgentTask).limit(800); - - const techRows = TechWatchSuggestion - ? await db.select().from(TechWatchSuggestion).orderBy(desc(TechWatchSuggestion.id)).limit(200) - : []; - // Index task ↔ issue const issueTaskMap = new Map(); for (const t of tasks) {