Update sunnylinkd.py to improve logging and connection timeout

The commit enhances the logging in the selfdrive/athena/sunnylinkd.py by adding an info statement when the handle_long_poll function starts. It also modifies the create_connection function call, removing the fixed 30 seconds timeout, providing more flexibility for connection time.
This commit is contained in:
DevTekVE
2024-06-10 09:40:08 +02:00
parent 6d8348ccf0
commit 12841b7bb4
+2 -2
View File
@@ -28,6 +28,7 @@ LOCAL_PORT_WHITELIST = {8022}
params = Params()
sunnylink_api = SunnylinkApi(params.get("SunnylinkDongleId", encoding='utf-8'))
def handle_long_poll(ws: WebSocket, exit_event: threading.Event | None) -> None:
cloudlog.info("sunnylinkd.handle_long_poll started")
end_event = threading.Event()
threads = [
@@ -169,8 +170,7 @@ def main(exit_event: threading.Event = None):
cloudlog.event("sunnylinkd.main.connecting_ws", ws_uri=ws_uri, retries=conn_retries)
ws = create_connection(ws_uri,
cookie="jwt=" + sunnylink_api.get_token(),
enable_multithread=True,
timeout=30.0)
enable_multithread=True)
cloudlog.event("sunnylinkd.main.connected_ws", ws_uri=ws_uri, retries=conn_retries,
duration=time.monotonic() - conn_start)
conn_start = None