- try:
- print("Refreshing prometheus config file for first time")
- await main_task(client)
- except Exception as error:
- print("Error in first configuration attempt!")
- print(error)
+ # Initial loop. First refresh of prometheus config file
+ first_refresh_completed = False
+ tries = 1
+ while tries <= 3:
+ try:
+ print("Refreshing prometheus config file for first time")
+ await main_task(client)
+ first_refresh_completed = True
+ except Exception as error:
+ print(f"Error in configuration attempt! Number of tries: {tries}/3")
+ print(error)
+ time.sleep(5)
+ tries += 1
+ if not first_refresh_completed:
+ print("Not possible to refresh prometheus config file for first time")
+ return