Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 7 additions & 6 deletions app/composables/useCharts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import type {
WeeklyDataPoint,
YearlyDataPoint,
} from '~/types/chart'
import { mapWithConcurrency } from '#shared/utils/async'
import { fetchNpmDownloadsRange } from '~/utils/npm/api'

export type PackumentLikeForTime = {
Expand Down Expand Up @@ -256,12 +257,12 @@ async function fetchDailyRangeChunked(packageName: string, startIso: string, end
return fetchDailyRangeCached(packageName, startIso, endIso)
}

const all: DailyRawPoint[] = []

for (const range of ranges) {
const part = await fetchDailyRangeCached(packageName, range.startIso, range.endIso)
all.push(...part)
}
const parts = await mapWithConcurrency(
ranges,
range => fetchDailyRangeCached(packageName, range.startIso, range.endIso),
10,
)
const all = parts.flat()

return mergeDailyPoints(all)
}
Expand Down
Loading