diff --git a/requeue_failed_jobs.py b/requeue_failed_jobs.py index 99eb4183..bcd1107d 100644 --- a/requeue_failed_jobs.py +++ b/requeue_failed_jobs.py @@ -17,18 +17,18 @@ def main(): conn = sqlite3.connect(db_path) cursor = conn.cursor() - # Zaehlen, wie viele Jobs betroffen sind (FAILED und SKIPPED) - cursor.execute("SELECT COUNT(*) FROM jobs WHERE status IN ('FAILED', 'SKIPPED')") + # Zaehlen, wie viele Jobs betroffen sind (FAILED, SKIPPED, PROCESSING) + cursor.execute("SELECT COUNT(*) FROM jobs WHERE status IN ('FAILED', 'SKIPPED', 'PROCESSING')") count = cursor.fetchone()[0] if count == 0: - print("No failed or skipped jobs found to requeue.") + print("No failed, skipped or stuck processing jobs found to requeue.") return - print(f"Found {count} failed/skipped jobs in {db_path}. Re-queueing them for re-evaluation...") + print(f"Found {count} jobs (FAILED/SKIPPED/PROCESSING) in {db_path}. Re-queueing them for re-evaluation...") - # Alle FAILED- und SKIPPED-Jobs auf PENDING zuruecksetzen - cursor.execute("UPDATE jobs SET status = 'PENDING', error_msg = NULL WHERE status IN ('FAILED', 'SKIPPED')") + # Alle betroffenen Jobs auf PENDING zuruecksetzen + cursor.execute("UPDATE jobs SET status = 'PENDING', error_msg = NULL, next_try_at = NULL WHERE status IN ('FAILED', 'SKIPPED', 'PROCESSING')") conn.commit() print(f"✅ Success! {cursor.rowcount} jobs have been re-queued for processing.")