Skip to content

Commit

Permalink
change timeout in the cli
Browse files Browse the repository at this point in the history
  • Loading branch information
stan-dot committed Apr 3, 2024
1 parent 36fec54 commit ba583c4
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/blueapi/cli/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -286,9 +286,10 @@ def env(obj: dict, reload: Optional[bool]) -> None:

# Initialize a variable to keep track of the environment status
environment_initialized = False

polling_count = 0
max_polling_count = 10
# Use a while loop to keep checking until the environment is initialized
while not environment_initialized:
while (not environment_initialized and polling_count < max_polling_count):
# Fetch the current environment status
environment_status = client.get_environment()

Expand All @@ -298,7 +299,10 @@ def env(obj: dict, reload: Optional[bool]) -> None:
environment_initialized = True
else:
print("Waiting for environment to initialize...")
sleep(5) # Wait for 5 seconds before checking again
polling_count += 1
sleep(1) # Wait for 1 seconds before checking again
if(polling_count == max_polling_count):
raise TimeoutError("Environment initialization timed out.")

# Once out of the loop, print the initialized environment status
pprint(environment_status)
Expand Down

0 comments on commit ba583c4

Please sign in to comment.