From 5972e950db40f03f9544c4272b9d8d609e2f79ce Mon Sep 17 00:00:00 2001 From: Cal Corum Date: Mon, 17 Apr 2023 11:45:46 -0500 Subject: [PATCH] Add retries to gauntlet draft --- gauntlets.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/gauntlets.py b/gauntlets.py index 7590627..878d5a2 100644 --- a/gauntlets.py +++ b/gauntlets.py @@ -401,10 +401,13 @@ async def run_draft(interaction: discord.Interaction, main_team, this_event, dra # Call /players/random to get eight cards p_query = None - try: - p_query = db_get('players/random', params=params) - except requests.ReadTimeout as e: - logging.error(f'run_draft - timeout error pulling player with params {params}') + retries = 0 + while retries < 10: + try: + p_query = db_get('players/random', params=params) + break + except Exception as e: + retries += 1 if p_query['count'] > 0: test_player_list = ''