diff options
| author | Christophe Besson <cbesson@gmail.com> | 2026-09-04 03:23:10 +0200 |
|---|---|---|
| committer | Christophe Besson <cbesson@gmail.com> | 2026-09-04 03:23:10 +0200 |
| commit | 5098e6cb54173b27673f5761ce187d799ba36b30 (patch) | |
| tree | afd6da05673ad3217ebd88e0975a435df34b32ca /packages/meshbay-node/tests | |
| parent | dad2157ada303a45655d2919f62905369525636f (diff) | |
| download | meshbay-5098e6cb54173b27673f5761ce187d799ba36b30.tar.gz | |
fix(node): run on the default Windows event loop (Proactor)
Verified end to end: a live browser peer on Windows connecting to a Windows
node — handshake, index sync, file download and an ffmpeg-transcoded video
stream all work on the ProactorEventLoop. aiortc only hangs on it in the
same-process loopback the tests use, which the repo-root conftest already
handles for the suite.
So the daemon no longer forces the SelectorEventLoop: that fixed
aiortc-in-one-process but broke ffmpeg (no subprocess support on a Windows
SelectorEventLoop). `use_compatible_event_loop()` becomes
`configure_event_loop()` — a no-op unless MESHBAY_NODE_EVENT_LOOP=selector
is set explicitly, as an escape hatch that probably never needs pulling.
This drops the planned "move ffmpeg off the asyncio loop" work.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Diffstat (limited to 'packages/meshbay-node/tests')
| -rw-r--r-- | packages/meshbay-node/tests/test_platform.py | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/packages/meshbay-node/tests/test_platform.py b/packages/meshbay-node/tests/test_platform.py index 2725df6..9358894 100644 --- a/packages/meshbay-node/tests/test_platform.py +++ b/packages/meshbay-node/tests/test_platform.py @@ -79,16 +79,26 @@ def test_check_media_tools_stores_the_resolved_paths(monkeypatch): # ── Event loop ─────────────────────────────────────────────────────────────── -def test_use_compatible_event_loop_is_a_noop_off_windows(monkeypatch): +def test_configure_event_loop_is_a_noop_off_windows(monkeypatch): monkeypatch.setattr(sys, "platform", "linux") + monkeypatch.setenv("MESHBAY_NODE_EVENT_LOOP", "selector") before = asyncio.get_event_loop_policy() - plat.use_compatible_event_loop() + plat.configure_event_loop() + assert asyncio.get_event_loop_policy() is before + + +def test_configure_event_loop_leaves_the_default_loop_alone_without_the_opt_in(monkeypatch): + monkeypatch.setattr(sys, "platform", "win32") + monkeypatch.delenv("MESHBAY_NODE_EVENT_LOOP", raising=False) + before = asyncio.get_event_loop_policy() + plat.configure_event_loop() assert asyncio.get_event_loop_policy() is before @pytest.mark.skipif(sys.platform != "win32", reason="WindowsSelectorEventLoopPolicy exists only on win32") -def test_use_compatible_event_loop_selects_the_selector_loop_on_windows(): - plat.use_compatible_event_loop() +def test_configure_event_loop_selector_opt_in(monkeypatch): + monkeypatch.setenv("MESHBAY_NODE_EVENT_LOOP", "selector") + plat.configure_event_loop() assert isinstance(asyncio.get_event_loop_policy(), asyncio.WindowsSelectorEventLoopPolicy) |