Skip to content

Commit

Permalink
Lower timeout for SD check on startup (#1562)
Browse files Browse the repository at this point in the history
* Lower timeout for SD check on startup

* Update backend/src/nodes/impl/external_stable_diffusion.py

Co-authored-by: Michael Schmidt <mitchi5000.ms@googlemail.com>

* Update backend/src/nodes/impl/external_stable_diffusion.py

Co-authored-by: Michael Schmidt <mitchi5000.ms@googlemail.com>

---------

Co-authored-by: Michael Schmidt <mitchi5000.ms@googlemail.com>
  • Loading branch information
joeyballentine and RunDevelopment committed Feb 15, 2023
1 parent f97950b commit ad9d065
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions backend/src/nodes/impl/external_stable_diffusion.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,9 @@ class ExternalServiceTimeout(Exception):
pass


def get(url) -> Dict:
def get(url, timeout: float = STABLE_DIFFUSION_REQUEST_TIMEOUT) -> Dict:
try:
response = requests.get(url, timeout=STABLE_DIFFUSION_REQUEST_TIMEOUT)
response = requests.get(url, timeout=timeout)
except requests.ConnectionError as exc:
raise ExternalServiceConnectionError(ERROR_MSG) from exc
except requests.exceptions.ReadTimeout as exc:
Expand Down Expand Up @@ -96,7 +96,7 @@ def verify_api_connection():
global has_api_connection # pylint: disable=global-statement
if has_api_connection is None:
has_api_connection = False
get(STABLE_DIFFUSION_OPTIONS_URL)
get(STABLE_DIFFUSION_OPTIONS_URL, timeout=0.5)
has_api_connection = True

if not has_api_connection:
Expand Down

0 comments on commit ad9d065

Please sign in to comment.