fix: Do not crash container on NetBox connection errors
Some checks failed
Docker Build & Push / build-and-push (push) Has been cancelled
Some checks failed
Docker Build & Push / build-and-push (push) Has been cancelled
This commit is contained in:
8
sync.py
8
sync.py
@@ -292,7 +292,6 @@ if __name__ == "__main__":
|
|||||||
log(f"SSL Verify: {VERIFY_SSL}")
|
log(f"SSL Verify: {VERIFY_SSL}")
|
||||||
|
|
||||||
error_counter = 0
|
error_counter = 0
|
||||||
MAX_ERRORS = 3
|
|
||||||
|
|
||||||
while running:
|
while running:
|
||||||
log(f"\n--- Sync Start: {time.ctime()} ---")
|
log(f"\n--- Sync Start: {time.ctime()} ---")
|
||||||
@@ -310,11 +309,8 @@ if __name__ == "__main__":
|
|||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
error_counter += 1
|
error_counter += 1
|
||||||
log(f"CRITICAL ERROR ({error_counter}/{MAX_ERRORS}): Sync abgebrochen! Grund: {e}")
|
log(f"ERROR ({error_counter}): Sync fehlgeschlagen! Grund: {e}")
|
||||||
|
log("Warte auf nächstes Intervall...")
|
||||||
if error_counter >= MAX_ERRORS:
|
|
||||||
log("Too many errors. Exiting to allow Docker restart.")
|
|
||||||
sys.exit(1)
|
|
||||||
|
|
||||||
# Smart Sleep: Check 'running' flag frequently
|
# Smart Sleep: Check 'running' flag frequently
|
||||||
sleep_steps = 10
|
sleep_steps = 10
|
||||||
|
|||||||
Reference in New Issue
Block a user