Mark a scan as interrupted (failed due to system restart). Args: scan_id: Scan ID to mark as interrupted Returns: bool: True if successful
(self, scan_id: str)
| 2087 | result['options'] = {} |
| 2088 | results.append(result) |
| 2089 | |
| 2090 | return results |
| 2091 | except Exception as e: |
| 2092 | logger.error(f"Failed to get interrupted scans: {e}") |
| 2093 | return [] |
| 2094 | |
| 2095 | def mark_scan_interrupted(self, scan_id: str) -> bool: |
| 2096 | """ |
| 2097 | Mark a scan as interrupted (failed due to system restart). |
| 2098 | |
| 2099 | Args: |
| 2100 | scan_id: Scan ID to mark as interrupted |
| 2101 | |
| 2102 | Returns: |
| 2103 | bool: True if successful |
| 2104 | """ |
| 2105 | try: |
| 2106 | with self.get_connection() as conn: |
| 2107 | cursor = conn.cursor() |
| 2108 | cursor.execute(""" |
| 2109 | UPDATE scan_jobs |
| 2110 | SET status = 'interrupted', |
| 2111 | error_message = 'Scan interrupted by system restart', |
| 2112 | updated_at = CURRENT_TIMESTAMP |
| 2113 | WHERE scan_id = ? |
| 2114 | """, (scan_id,)) |
| 2115 | conn.commit() |
| 2116 | return cursor.rowcount > 0 |
no test coverage detected