INNER CODE UNIT · Python
cutoff_dt
KatrielMoses/voidaccess · api/main.py:252
cutoff_dt = datetime.now(timezone.utc) - timedelta(
minutes=cutoff_minutes
)
query = query.filter(Investigation.created_at < cutoff_dt)
stuck = query.all()
if not stuck:
return 0
cancelled_ids = [inv.id for inv in stuck if inv.cancellation_requested]
failed_ids = [inv.id for inv in stuck if not inv.cancellation_requested]
sweep_reason = (
"Server restarted mid-investigation"
if cutoff_minutes is None
else f"Investigation timed out after {cutoff_minutes} min — "
"server may have restarted or pipeline may be hung"
)