Skip to content

Commit

Permalink
Fix loop
Browse files Browse the repository at this point in the history
  • Loading branch information
JonathanRosenboim committed Aug 19, 2024
1 parent a53e242 commit e32ff26
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/shared/clients/jit.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,17 +70,20 @@ def _handle_resoponse(response, existing_teams):
# Check if the request was successful
if response.status_code == 200:
after = _handle_resoponse(response, existing_teams)
while after:
while True:
response = requests.get(
f"{url}&after={after}", headers=headers)
if response.status_code == 200:
after = _handle_resoponse(response, existing_teams)
if not after:
break
else:
logger.error(
f"Failed to retrieve teams. Status code: {response.status_code}, {response.text}")
return []

logger.info("Retrieved existing teams successfully.")
logger.info(
f"Retrieved {len(existing_teams)} existing teams successfully.")
return [TeamAttributes(**team) for team in existing_teams]
else:
logger.error(
Expand Down

0 comments on commit e32ff26

Please sign in to comment.