diff --git a/app/utils.py b/app/utils.py index d75ba6f..f1d29de 100644 --- a/app/utils.py +++ b/app/utils.py @@ -3,6 +3,8 @@ import re from app.settings import powerbars, groups import time +retries = 5 + def check_input_error(tn): tn.write("/\r\n".encode('ascii')) for _ in range(3): @@ -19,7 +21,7 @@ def get_telnet_connection(powerbar): def run_telnet_command(powerbar, command): - retries = 5 + for _ in range(retries): try: tn = get_telnet_connection(powerbar) @@ -32,7 +34,6 @@ def run_telnet_command(powerbar, command): pass def get_baytech_status_outlet_telnet(powerbar): - retries = 5 for _ in range(retries): try: # Create a Telnet object and connect to the host