refactor: parallel LLM analysis via asyncio.gather instead of sequential
This commit is contained in:
@@ -228,12 +228,15 @@ async def _run_llm_analysis(findings: list[Finding], session: AsyncSession) -> l
|
||||
await session.commit()
|
||||
|
||||
reports = []
|
||||
for finding in findings:
|
||||
|
||||
async def _analyze_one(finding):
|
||||
report = await analyze_finding(finding.data)
|
||||
if report:
|
||||
finding.report = report
|
||||
reports.append(report)
|
||||
else:
|
||||
finding.report = None
|
||||
|
||||
await asyncio.gather(*(_analyze_one(f) for f in findings))
|
||||
await session.commit()
|
||||
return reports
|
||||
|
||||
Reference in New Issue
Block a user