this repo has no description
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Parallelize session processing with concurrency limit

Process sessions in batches of 5 concurrently instead of sequentially.
Results are collected first, then displayed grouped by project.

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

alice 584948f0 62d37b64

+54 -24
+54 -24
src/cli/process.ts
··· 130 130 131 131 console.log(`Found ${sessions.length} session(s) to check\n`); 132 132 133 - // Group by project for display 133 + // Process sessions in parallel with concurrency limit 134 + const CONCURRENCY = 5; 135 + const results: Array<{ 136 + session: SessionFile; 137 + result?: Awaited<ReturnType<typeof processSession>>; 138 + error?: unknown; 139 + }> = []; 140 + 141 + // Process in batches 142 + for (let i = 0; i < sessions.length; i += CONCURRENCY) { 143 + const batch = sessions.slice(i, i + CONCURRENCY); 144 + const batchResults = await Promise.all( 145 + batch.map(async (session) => { 146 + try { 147 + const result = await processSession(session, verbose, dateFilter); 148 + return { session, result }; 149 + } catch (error) { 150 + return { session, error }; 151 + } 152 + }) 153 + ); 154 + results.push(...batchResults); 155 + } 156 + 157 + // Group results by project for display 134 158 const byProject = groupByProject(sessions); 135 159 let processed = 0; 136 160 let errors = 0; ··· 141 165 142 166 let skipped = 0; 143 167 let filtered = 0; 168 + 144 169 for (const session of projectSessions) { 145 - try { 146 - const result = await processSession(session, verbose, dateFilter); 170 + const resultEntry = results.find((r) => r.session === session); 171 + if (!resultEntry) continue; 147 172 148 - if (result.filtered) { 149 - filtered++; 150 - continue; 173 + if (resultEntry.error) { 174 + errors++; 175 + console.log(` ✗ ${session.sessionId.slice(0, 8)}... - Error: ${resultEntry.error}`); 176 + if (verbose) { 177 + console.error(resultEntry.error); 151 178 } 179 + continue; 180 + } 152 181 153 - if (result.skipped) { 154 - skipped++; 155 - if (verbose) { 156 - console.log(` ⊘ ${session.sessionId.slice(0, 8)}... (skipped - no work)`); 157 - } 158 - continue; 159 - } 182 + const result = resultEntry.result!; 160 183 161 - if (result.date) { 162 - datesProcessed.add(result.date); 163 - } 164 - processed++; 184 + if (result.filtered) { 185 + filtered++; 186 + continue; 187 + } 165 188 166 - const duration = formatDuration(result.startTime, result.endTime); 167 - const summary = result.summary.slice(0, 60); 168 - console.log(` ✓ ${session.sessionId.slice(0, 8)}... (${duration}) → "${summary}..."`); 169 - } catch (error) { 170 - errors++; 171 - console.log(` ✗ ${session.sessionId.slice(0, 8)}... - Error: ${error}`); 189 + if (result.skipped) { 190 + skipped++; 172 191 if (verbose) { 173 - console.error(error); 192 + console.log(` ⊘ ${session.sessionId.slice(0, 8)}... (skipped - no work)`); 174 193 } 194 + continue; 175 195 } 196 + 197 + if (result.date) { 198 + datesProcessed.add(result.date); 199 + } 200 + processed++; 201 + 202 + const duration = formatDuration(result.startTime, result.endTime); 203 + const summary = result.summary.slice(0, 60); 204 + console.log(` ✓ ${session.sessionId.slice(0, 8)}... (${duration}) → "${summary}..."`); 176 205 } 206 + 177 207 const notes = []; 178 208 if (skipped > 0) notes.push(`${skipped} empty`); 179 209 if (filtered > 0) notes.push(`${filtered} outside date range`);