You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
returnoperators.handle_error(f"The server timed out. Try again in a moment, or get help. [Get help with timeouts]({config.HELP_WITH_TIMEOUTS_URL})", "timeout")
46
-
print("The horde took "+str(time.monotonic() -start_time) +" seconds to imagine this frame.")
50
+
returnoperators.handle_error(f"There was an error sending this request to Stable Horde. Please try again in a moment.", "timeout")
51
+
exceptExceptionase:
52
+
img_file.close()
53
+
returnoperators.handle_error(f"Error with Stable Horde. Full error message: {e}", "unknown_error")
54
+
55
+
# Check the status of the request (For at most request_timeout seconds)
56
+
foriinrange(request_timeout()):
57
+
try:
58
+
time.sleep(1)
59
+
URL=API_CHECK_URL+"/"+id
60
+
print(f"Checking status of request at Stable Horde API: {URL}")
print(f"Waiting for {str(time.monotonic() -start_time)}s. Response: {response.json()}")
63
+
ifresponse.json()["done"] ==True:
64
+
print("The horde took "+str(time.monotonic() -start_time) +"s to imagine this frame.")
65
+
break
66
+
exceptrequests.exceptions.ReadTimeout:
67
+
# Ignore timeouts
68
+
print("WARN: Timeout while checking status")
69
+
exceptExceptionase: # Catch all other errors
70
+
returnoperators.handle_error(f"Error while checking status: {e}", "unknown_error")
71
+
if (i==request_timeout() -1):
72
+
returnoperators.handle_error(f"Timeout generating image. Try again in a moment, or get help. [Get help with timeouts]({config.HELP_WITH_TIMEOUTS_URL})", "timeout")
73
+
74
+
# Get the image
75
+
try:
76
+
URL=API_GET_URL+"/"+id
77
+
print(f"Retrieving image from Stable Horde API: {URL}")
# print("Send to Stable Horde: " + str(stablehorde_params))
50
-
# print("Received from Stable Horde: " + str(response.json()))
85
+
exceptrequests.exceptions.ReadTimeout:
86
+
returnoperators.handle_error(f"Timeout getting image from Stable Horde. Try again in a moment, or get help. [Get help with timeouts]({config.HELP_WITH_TIMEOUTS_URL})", "timeout")
87
+
exceptExceptionase:
88
+
returnoperators.handle_error(f"Error with Stable Horde. Full error message: {e}", "unknown_error")
0 commit comments