From b510d1959752b1647d311f809f3c6a2bd81132b6 Mon Sep 17 00:00:00 2001 From: Matthew Frost Date: Sun, 3 Dec 2023 01:56:17 +0100 Subject: [PATCH] timeouts --- app/views.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/app/views.py b/app/views.py index dfe7768..308224b 100644 --- a/app/views.py +++ b/app/views.py @@ -34,12 +34,17 @@ def run_telnet_command(powerbar, command): try: tn = get_telnet_connection(powerbar) tn.write(f"{command}\r\n".encode('ascii')) + time.sleep(0.2) + tn.write(f"{command}\r\n".encode('ascii')) return except Exception as e: print(f"Telnet error: {e}") - active_telnet_connections.pop(powerbar) + if powerbar in active_telnet_connections: + active_telnet_connections.pop(powerbar) tn = get_telnet_connection(powerbar) tn.write(f"{command}\r\n".encode('ascii')) + time.sleep(0.2) + tn.write(f"{command}\r\n".encode('ascii')) return