fix retry

This commit is contained in:
Aron Petau 2026-01-04 18:32:49 +01:00
parent a83f3002ca
commit 044ef111ac

View file

@ -108,7 +108,22 @@ class ApplicationHandler:
message += f"\n<b>Reason:</b> <i>{html.escape(fail_msg)}</i>" message += f"\n<b>Reason:</b> <i>{html.escape(fail_msg)}</i>"
else: else:
# Should not happen if logic is correct, but fallback # Should not happen if logic is correct, but fallback
# Save as failed so /retryfailed can retry later
message += "\n\n\u2139\ufe0f <b>No application attempted (internal logic error)</b>" message += "\n\n\u2139\ufe0f <b>No application attempted (internal logic error)</b>"
failed_result = {
"listing_id": listing["id"],
"company": company,
"link": link,
"timestamp": listing.get("timestamp", ""),
"success": False,
"message": "Internal logic error: listing not in application_results",
"address": listing.get("address", ""),
"rooms": listing.get("rooms", ""),
"price": listing.get("price", ""),
"retries": 0
}
self.save_application(failed_result)
logger.warning(f"[INTERNAL ERROR] Saved as failed: {listing['id']} - {listing.get('address', '')}")
else: else:
# Autopilot was off or not attempted at all # Autopilot was off or not attempted at all
message += "\n\n\u2139\ufe0f <b>No application attempted (autopilot off)</b>" message += "\n\n\u2139\ufe0f <b>No application attempted (autopilot off)</b>"