From ea12a44836c4e127cfe316eccf64cb3a4b519a24 Mon Sep 17 00:00:00 2001 From: terrtia Date: Mon, 9 Dec 2024 16:44:40 +0100 Subject: [PATCH] fix: [crawler] avoid crawler loop if a capture end up in an invalid state --- bin/crawlers/Crawler.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/bin/crawlers/Crawler.py b/bin/crawlers/Crawler.py index b1eda5a1..99ed03a4 100755 --- a/bin/crawlers/Crawler.py +++ b/bin/crawlers/Crawler.py @@ -164,9 +164,15 @@ class Crawler(AbstractModule): self.logger.warning(f'capture UNKNOWN Timeout, {task.uuid} Send back in queue') else: capture.update(status) - else: + elif status == crawlers.CaptureStatus.QUEUED or status == crawlers.CaptureStatus.ONGOING: capture.update(status) print(capture.uuid, crawlers.CaptureStatus(status).name, int(time.time())) + # Invalid State + else: + task = capture.get_task() + task.reset() + capture.delete() + self.logger.warning(f'ERROR INVALID CAPTURE STATUS {status}, {task.uuid} Send back in queue') except ConnectionError: self.logger.warning(f'Lacus ConnectionError, capture {capture.uuid}')