Skip to content

Commit

Permalink
fix issue on aborting scans that are already success or aborted
Browse files Browse the repository at this point in the history
  • Loading branch information
yogeshojha committed Jul 22, 2024
1 parent 7550230 commit ded8c16
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions web/api/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -844,6 +844,9 @@ def abort_subscan(subscan):
for scan_id in scan_ids:
try:
scan = ScanHistory.objects.get(id=scan_id)
# if scan is already successful or aborted then do nothing
if scan.scan_status == SUCCESS_TASK or scan.scan_status == ABORTED_TASK:
continue
response = abort_scan(scan)
except Exception as e:
logger.error(e)
Expand All @@ -852,6 +855,8 @@ def abort_subscan(subscan):
for subscan_id in subscan_ids:
try:
subscan = SubScan.objects.get(id=subscan_id)
if subscan.scan_status == SUCCESS_TASK or subscan.scan_status == ABORTED_TASK:
continue
response = abort_subscan(subscan)
except Exception as e:
logger.error(e)
Expand Down

0 comments on commit ded8c16

Please sign in to comment.