Skip to content

Commit 926f449

Browse files
vicferpoyjfagoagas
authored andcommitted
fix(overviews): manage overview exceptions and use batch_size with bulk (#7140)
1 parent 646668c commit 926f449

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

api/src/backend/tasks/jobs/scan.py

+11-2
Original file line numberDiff line numberDiff line change
@@ -344,9 +344,18 @@ def perform_prowler_scan(
344344
total_requirements=compliance["total_requirements"],
345345
)
346346
)
347-
with rls_transaction(tenant_id):
348-
ComplianceOverview.objects.bulk_create(compliance_overview_objects)
347+
try:
348+
with rls_transaction(tenant_id):
349+
ComplianceOverview.objects.bulk_create(
350+
compliance_overview_objects, batch_size=100
351+
)
352+
except Exception as overview_exception:
353+
import sentry_sdk
349354

355+
sentry_sdk.capture_exception(overview_exception)
356+
logger.error(
357+
f"Error storing compliance overview for scan {scan_id}: {overview_exception}"
358+
)
350359
if exception is not None:
351360
raise exception
352361

0 commit comments

Comments
 (0)