diff --git a/src/lib/github.ts b/src/lib/github.ts index ed7dd37..db4b574 100644 --- a/src/lib/github.ts +++ b/src/lib/github.ts @@ -685,20 +685,22 @@ export const fetchActivity = cache(async function fetchActivity( // Suppress unhandled promise rejections for subsequent pages if we break early or throw promises.forEach((p) => p.catch((e) => logger.error("Event fetch promise rejected:", e))); - for (const p of promises) { - try { - const events = await p; - allEvents.push(...events); - if (events.length < 100) break; - } catch (error) { + const results = await Promise.all(promises.map(p => p.catch(e => e))); + + for (const result of results) { + if (result instanceof Error) { if ( - error instanceof UserNotFoundError || - error instanceof RateLimitError + result instanceof UserNotFoundError || + result instanceof RateLimitError ) { - throw error; + throw result; } break; } + + const events = result as GitHubEvent[]; + allEvents.push(...events); + if (events.length < 100) break; } // 曜日×時間帯ヒートマップ (7×24)