This commit is contained in:
Your Name
2024-02-16 18:44:54 -06:00
parent 5e9d7d4776
commit d0ccab85ec

View File

@@ -24,6 +24,7 @@ class Watcher:
try: try:
watcher_sock.sendall(message_json.encode('utf-8') + b'\n') watcher_sock.sendall(message_json.encode('utf-8') + b'\n')
except socket.error: except socket.error:
nothing=False
# Handle potential error in sending (e.g., if connection was lost) # Handle potential error in sending (e.g., if connection was lost)
watcher_sock.close() # Close the current socket to clean up resources watcher_sock.close() # Close the current socket to clean up resources
watcher_sock = None # Reset sock to ensure reconnection attempt on next call watcher_sock = None # Reset sock to ensure reconnection attempt on next call