From 1bd2bf753c58e8bde219c17b0076ddf97ba52918 Mon Sep 17 00:00:00 2001 From: Calvin Huang Date: Mon, 23 Dec 2024 14:41:10 +0800 Subject: [PATCH] fix: retry api only when request failed to comfyui api --- src/rp_handler.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/rp_handler.py b/src/rp_handler.py index b009d0ed..ab9b926c 100644 --- a/src/rp_handler.py +++ b/src/rp_handler.py @@ -173,7 +173,7 @@ def queue_workflow(workflow): try: req = urllib.request.Request(f"http://{COMFY_HOST}/prompt", data=data) return json.loads(urllib.request.urlopen(req).read()) - except Exception as e: + except requests.RequestException as e: print(f"Error queuing workflow: {str(e)}. Retrying...") time.sleep(COMFY_API_AVAILABLE_INTERVAL_MS / 1000) retries += 1