Disabled new endpoint as well

This commit is contained in:
Alex Janousek
2025-09-26 16:26:48 -04:00
parent 5b4a1820a9
commit ef8914fbcd

View File

@@ -113,46 +113,50 @@ def cancel_job(service_id, job_id):
@user_has_permissions() @user_has_permissions()
def view_job_status_poll(service_id, job_id): def view_job_status_poll(service_id, job_id):
""" """
Poll status endpoint using new lightweight cached API endpoint. DISABLED: Lightweight polling endpoint no longer supported.
Returns minimal data needed for polling. Use manual page refresh instead.
""" """
start_time = time.time() current_app.logger.info(f"Disabled lightweight polling endpoint accessed for job {job_id[:8]} - returning 410 Gone")
abort(410, "Lightweight polling endpoint disabled. Please refresh the page manually.")
# Use new lightweight status endpoint # Original polling code - commented out for manual refresh mode
try: # start_time = time.time()
status_data = job_api_client.get_job_status(service_id, job_id) #
# # Use new lightweight status endpoint
# Validate the response has expected fields # try:
required_fields = ["sent_count", "failed_count", "pending_count", "total_count", "processing_finished"] # status_data = job_api_client.get_job_status(service_id, job_id)
if all(key in status_data for key in required_fields): #
response_data = { # # Validate the response has expected fields
"sent_count": status_data["sent_count"], # required_fields = ["sent_count", "failed_count", "pending_count", "total_count", "processing_finished"]
"failed_count": status_data["failed_count"], # if all(key in status_data for key in required_fields):
"pending_count": status_data["pending_count"], # response_data = {
"total_count": status_data["total_count"], # "sent_count": status_data["sent_count"],
"finished": status_data["processing_finished"], # "failed_count": status_data["failed_count"],
} # "pending_count": status_data["pending_count"],
processed_count = status_data["sent_count"] + status_data["failed_count"] # "total_count": status_data["total_count"],
else: # "finished": status_data["processing_finished"],
current_app.logger.error(f"Status endpoint returned invalid response for job {job_id[:8]}: {status_data}") # }
abort(500, "Invalid status response from API") # processed_count = status_data["sent_count"] + status_data["failed_count"]
# else:
except Exception as e: # current_app.logger.error(f"Status endpoint returned invalid response for job {job_id[:8]}: {status_data}")
current_app.logger.error(f"Status endpoint failed for job {job_id[:8]}: {e}") # abort(500, "Invalid status response from API")
abort(500, "Status endpoint unavailable") #
# except Exception as e:
response_time_ms = round((time.time() - start_time) * 1000, 2) # current_app.logger.error(f"Status endpoint failed for job {job_id[:8]}: {e}")
response_json = json.dumps(response_data) # abort(500, "Status endpoint unavailable")
response_size_bytes = len(response_json.encode("utf-8")) #
# response_time_ms = round((time.time() - start_time) * 1000, 2)
current_app.logger.info( # response_json = json.dumps(response_data)
f"Poll status request - job_id={job_id[:8]} " # response_size_bytes = len(response_json.encode("utf-8"))
f"response_size={response_size_bytes}b " #
f"response_time={response_time_ms}ms " # current_app.logger.info(
f"progress={processed_count}/{response_data['total_count']}" # f"Poll status request - job_id={job_id[:8]} "
) # f"response_size={response_size_bytes}b "
# f"response_time={response_time_ms}ms "
return jsonify(response_data) # f"progress={processed_count}/{response_data['total_count']}"
# )
#
# return jsonify(response_data)
@main.route("/services/<uuid:service_id>/jobs/<uuid:job_id>.json") @main.route("/services/<uuid:service_id>/jobs/<uuid:job_id>.json")