Sleep for 60 seconds if an exception occurs to avoid spamming Bring servers
This commit is contained in:
parent
6999a674d5
commit
ef9cc51750
1 changed files with 5 additions and 1 deletions
6
main.py
6
main.py
|
|
@ -11,6 +11,8 @@ from bring_api.exceptions import BringException
|
|||
|
||||
load_dotenv()
|
||||
|
||||
EXCEPTION_SLEEP_INTERVAL = 60
|
||||
|
||||
class BringPlugin:
|
||||
SLEEP_INTERVAL = 15 * 60 # 15 minutes
|
||||
|
||||
|
|
@ -67,7 +69,9 @@ if __name__ == "__main__":
|
|||
loop.run_until_complete(bring_plugin.run())
|
||||
except BringException as e:
|
||||
print(f"Bring exception occured: {e}")
|
||||
print(f"Sleeping for {EXCEPTION_SLEEP_INTERVAL} seconds.")
|
||||
time.sleep(EXCEPTION_SLEEP_INTERVAL)
|
||||
print(f"Retrying the service")
|
||||
except Exception as e:
|
||||
print(f"Unknowne exception occured: {e}")
|
||||
print(f"Unknown exception occured: {e}")
|
||||
raise
|
||||
Loading…
Add table
Add a link
Reference in a new issue