sunnylink: shorter timeout for websocket reconnect (#1681)

* separate

* no need

* shorten

* lint
This commit is contained in:
Jason Wen
2026-02-09 23:46:39 -05:00
committed by GitHub
parent 7722d14b89
commit c51b41e96a
2 changed files with 4 additions and 8 deletions

View File

@@ -18,8 +18,8 @@ class Api:
return self.service.get_token(payload_extra, expiry_hours)
def api_get(endpoint, method='GET', timeout=None, access_token=None, session=None, **params):
return CommaConnectApi(None).api_get(endpoint, method, timeout, access_token, session, **params)
def api_get(endpoint, method='GET', timeout=None, access_token=None, session=None, json=None, **params):
return CommaConnectApi(None).api_get(endpoint, method, timeout, access_token, session, json, **params)
def get_key_pair() -> tuple[str, str, str] | tuple[None, None, None]:

View File

@@ -12,7 +12,6 @@ import errno
import gzip
import json
import os
import ssl
import threading
import time
@@ -274,9 +273,7 @@ def startLocalProxy(global_end_event: threading.Event, remote_ws_uri: str, local
sunnylink_api = SunnylinkApi(sunnylink_dongle_id)
cloudlog.debug("athena.startLocalProxy.starting")
ws = create_connection(
remote_ws_uri, header={"Authorization": f"Bearer {sunnylink_api.get_token()}"}, enable_multithread=True, sslopt={"cert_reqs": ssl.CERT_NONE}
)
ws = create_connection(remote_ws_uri, header={"Authorization": f"Bearer {sunnylink_api.get_token()}"}, enable_multithread=True)
return start_local_proxy_shim(global_end_event, local_port, ws)
@@ -310,8 +307,7 @@ def main(exit_event: threading.Event | None = None):
ws_uri,
header={"Authorization": f"Bearer {sunnylink_api.get_token()}"},
enable_multithread=True,
sslopt={"cert_reqs": ssl.CERT_NONE if "localhost" in ws_uri else ssl.CERT_REQUIRED},
timeout=SUNNYLINK_RECONNECT_TIMEOUT_S,
timeout=30.0,
)
cloudlog.event("sunnylinkd.main.connected_ws", ws_uri=ws_uri, retries=conn_retries,
duration=time.monotonic() - conn_start)