Skip to content

Commit 9f6bc45

Browse files
tzy-17claude
andcommitted
fix(gateway): add errorMode stop + hasError guard to usage concurrency
Preserve the fail-fast semantics of the original Promise.all by setting errorMode: "stop" and explicitly throwing firstError, matching the existing runTasksWithConcurrency usage in the same file at line 1290. Co-Authored-By: Claude <[email protected]>
1 parent 49b859f commit 9f6bc45

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

‎src/gateway/server-methods/usage.ts‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -869,6 +869,7 @@ async function loadAllAgentCostUsageSummary(params: {
869869
const SUMMARIES_CONCURRENCY = 8;
870870
const summariesResult = await runTasksWithConcurrency({
871871
limit: SUMMARIES_CONCURRENCY,
872+
errorMode: "stop",
872873
tasks: agentIds.map(
873874
(agentId) => () =>
874875
loadCostUsageSummaryFromCache({
@@ -882,6 +883,9 @@ async function loadAllAgentCostUsageSummary(params: {
882883
}),
883884
),
884885
});
886+
if (summariesResult.hasError) {
887+
throw summariesResult.firstError;
888+
}
885889
const summaries = summariesResult.results;
886890
const dailyByDate = new Map<string, CostUsageTotals & { date: string }>();
887891
const totals = createEmptyCostUsageTotals();

0 commit comments

Comments
 (0)