seawolf2357 commited on
Commit
a8bd79f
·
verified ·
1 Parent(s): ec69c0c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -3
app.py CHANGED
@@ -194,10 +194,10 @@ class MyClient(discord.Client):
194
  try:
195
  return await func()
196
  except HTTPError as e:
197
- if e.response.status_code == 503:
198
- logging.warning(f"503 error encountered. Retrying with secondary model.")
199
  self.hf_client = hf_client_secondary
200
- return await func() # Try immediately with the secondary model
201
  else:
202
  raise
203
 
 
194
  try:
195
  return await func()
196
  except HTTPError as e:
197
+ if e.response.status_code == 503 and i < retries - 1:
198
+ logging.warning(f"503 error encountered. Retrying in {delay} seconds...")
199
  self.hf_client = hf_client_secondary
200
+ await asyncio.sleep(delay)
201
  else:
202
  raise
203