From 480f08b547720cbb97667706a8dc89c8c6b2608d Mon Sep 17 00:00:00 2001 From: break27 Date: Wed, 22 Apr 2026 17:34:14 +0800 Subject: [PATCH] update: client.js now waits for websocket connection to be open --- pyproject.toml | 2 +- src/common/jsonrpc2/client.js | 4 ++++ src/common/utils/selenium.py | 3 --- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 9c1b9da..5c77c5e 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -5,7 +5,7 @@ build-backend = "setuptools.build_meta" [project] name = "common" description = "Reusable code stubs" -version = "0.1.12" +version = "0.1.13" requires-python = ">=3.13" authors = [ { name="BreakerBear", email="breakerbear@autistic.men" }, diff --git a/src/common/jsonrpc2/client.js b/src/common/jsonrpc2/client.js index 2f60f89..3866414 100644 --- a/src/common/jsonrpc2/client.js +++ b/src/common/jsonrpc2/client.js @@ -12,6 +12,10 @@ CONNECTION.addEventListener('message', (e) => { else promise.resolve(message.result); }); +while (CONNECTION.readyState !== CONNECTION.OPEN) { + await new Promise(resolve => setTimeout(resolve, 1000)); +} + const LogRecord = { format: (record) => { let ms = record.created * 1000 - new Date().getTimezoneOffset() * 60000; diff --git a/src/common/utils/selenium.py b/src/common/utils/selenium.py index 896c8c9..d2f77cd 100644 --- a/src/common/utils/selenium.py +++ b/src/common/utils/selenium.py @@ -75,6 +75,3 @@ def setup(a: WebDriver, b: int, c: float, d: float): attempts = b timeout = c interval = d - - from common.jsonrpc2.server import connection - until(lambda _: connection is not None, watch=False)