Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
epipav committed Nov 10, 2024
1 parent 3788cc0 commit 877368b
Showing 1 changed file with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,16 @@ export async function getMaxConcurrentRequests(
): Promise<number> {
const serviceMap: Partial<Record<MemberEnrichmentSource, IEnrichmentService>> = {}
const distinctEnrichableSources = new Set<MemberEnrichmentSource>()
let maxConcurrentRequestsInAllSources = 0

for (const source of possibleSources) {
serviceMap[source] = EnrichmentSourceServiceFactory.getEnrichmentSourceService(source, svc.log)
if (serviceMap[source].maxConcurrentRequests > maxConcurrentRequestsInAllSources) {
maxConcurrentRequestsInAllSources = Math.max(
maxConcurrentRequestsInAllSources,
serviceMap[source].maxConcurrentRequests,
)
}
}
for (const member of members) {
const enrichmentInput = await getEnrichmentInput(member)
Expand All @@ -57,7 +64,7 @@ export async function getMaxConcurrentRequests(
})
}

let smallestMaxConcurrentRequests = Infinity
let smallestMaxConcurrentRequests = maxConcurrentRequestsInAllSources

Array.from(distinctEnrichableSources).forEach(async (source) => {
smallestMaxConcurrentRequests = Math.min(
Expand Down

0 comments on commit 877368b

Please sign in to comment.